First: great work on a great little library! :)
I have one question regarding DTD's. I know TinyXML does not "parse or use" DTD's, but I was hoping it would safely ignore them. The reason for this is that I would like to be able to have the document validated by one of myriad tools available to do so before the document is published (after which it will be used by a client making use of TinyXML). My document therefore has an internal DTD ("<!DOCTYPE blah [ ... ]>") but this causes problems for TinyXML. Perhaps I'm doing something wrong in my parsing?
Again, thanks for a great little library and for spreading support of an excellent standard!
I've been trying to come up with a method to do the same thing. You could just iterate through the sibling nodes, until you reach the node you want to start from. The only problem, is the parser tends to blow up on the end of the DOCTYPE tag. (ie, the ]> part of the tag.)
Here's the code I have so far... Maybe someone can help us find a way to deal with the end of the tag.
TiXmlDocument doc( "data.xml" );
TiXmlNode* root = doc.FirstChild();
while(root->Value() != "tagtofind")
root = root->NextSibling();
I'm working on the next version, maining UTF-8, but also trying to clean up some problems like this. I added a bug:
Could you add a small test case that illustrates the problem and post it to the bug? It's a simple test, but experience shows that if I make test cases, I sometimes miss a use case that people want.
I think, I had the same problem with TinyXml, and I hope, I have solved it somehow. You have to change a little bit the function, which is called TiXmlUnknown::Parse (counting nestedness of "<",">"). So the main while cycle now should
look like as follows:
size_t nestedness = 1;
while (p && *p && ( *p != '>' || (nestedness > 1) ))
value += *p;
if (*p == '<')
if (*p == '>')
Another thing which I would like to see from TinyXML is the specific mention of the legal inclusion of the well-formed XML header:
<?xml version="1.0" encoding="UTF-8"?>
So far, it does not appear to present a problem - but with all the caveats about what can NOT be included in a TinyXML document, it would be comforting to know that including the XML specifier as shown above would never present a problem.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.