lizh06 / ticpp

Automatically exported from code.google.com/p/ticpp
0 stars 0 forks source link

Stylesheet reference is not saved to stream #50

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a ticpp::Document containing a stylesheet:

    ticpp::Document document;
    ticpp::Declaration *decl = new ticpp::Declaration ("1.0", "UTF-8", "");
    document.LinkEndChild (decl);

    ticpp::StylesheetReference *style = new
ticpp::StylesheetReference("text/xsl", "stylesheet.xsl");
    document.LinkEndChild (style);

    ticpp::Element *root = new ticpp::Element("root ");
    document.LinkEndChild(root);

2. When saving this to a file, the stylesheet reference is in the document:

document.SaveFile ("temp.xml");

this generates:

<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="stylesheet.xsl" ?>
<page />

3. When saving the document to a stringstream, the reference is gone

    std::stringstream output_stream;
    output_stream << document << std::endl;
    std::cout << output_stream.str () << std::endl;

results in:

<?xml version="1.0" encoding="UTF-8" ?><page />

What version of the product are you using? On what operating system?

I think it was a svn source from 22/04, on win xp, compiled using the
codeblocks generated project

Please provide any additional information below.

Original issue reported on code.google.com by shoefat...@gmail.com on 16 May 2009 at 8:30

GoogleCodeExporter commented 9 years ago
in addition, writing the stylesheet-reference directly to the stream also 
returns an
empty string:

output_stream << *style << std::endl;

the resulting string only contains the newline-character

Original comment by shoefat...@gmail.com on 16 May 2009 at 9:49

GoogleCodeExporter commented 9 years ago
I have looked into the code, and the function TiXmlPrinter::Visit is missing 
for a
TiXmlStylesheetReference. After adding this, writing an xml to a stringstream, 
works
like expected.

bool TiXmlPrinter::Visit( const TiXmlStylesheetReference& stylesheet )
{
    DoIndent();
    stylesheet.Print( 0, 0, &buffer );
    DoLineBreak();
    return true;
}

Original comment by shoefat...@gmail.com on 16 May 2009 at 10:15

GoogleCodeExporter commented 9 years ago
Fixed in svn revision 106

Original comment by rpusz...@gmail.com on 16 May 2009 at 7:58