#50 eight line patch to correctly read <?xml-* tags

open
nobody
None
5
2010-06-26
2010-06-26
No

Hi,
TinyXML can't parse file with <?xml-*> tags like <?xml-stylesheet?>, a commonly used tag for automatically generated XML files.

Main problem is that not even the rest of the file is read correctly, but it fails completely to read these files as these tags are misinterpreted as <?xml?> element.

The following lines allow to parse all XML documents with "<?xml-*" tags, where these tags are parsed as "TiXmlUnknown" (the user can then process them, but at least the rest of the document is parsed correctly).

Don't have patch/diff at hand, so just via text for tinyxmlparser.cpp:

Add lines:
Line 825 const char* xmlUnknown = { "<?xml-" };

Replace line 828:
829 if ( StringEqual( p, xmlUnknown, true, encoding ) )
830 {
831 #ifdef DEBUG_PARSER
832 TIXML_LOG( "XML parsing Declaration\n" );
833 #endif
834 returnNode = new TiXmlUnknown();
835 }
836 else if ( StringEqual( p, xmlHeader, true, encoding ) )

see also
http://libufo.cvs.sourceforge.net/viewvc/libufo/ufo-0.5/src/xml/tinyxmlparser.cpp?revision=1.2&view=markup

Best,
Johannes

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks