-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Porting from tinyxml to tinyxml2 #398
Comments
Yes, you do. The declaration will not be added to the document structure until you add it explicitly. The test project contains an example (search for |
Thanks. |
Since I am porting my application to tinyxml2, I can work on this ,if you think it can be helpful to others. @dmitry |
Well, I cannot comment on this, I never saw any code for earlier tinyxml. Perhaps @leethomason has some ideas. |
It's been so long since I ported over...I've sort of forgotten the stumbling blocks. Should have documented it then. I would like to address some issues in the Readme: the TinyXML-1 vs. 2 part is pretty outdated (there is no reason to use TinyXML-1 any more.) If you had a brief list of porting notes, it could go in the readme, and replace much of the existing 1 vs. 2 discussion. |
Also a good issue to remember to more aggressively deprecate TinyXML-1. That version should be fully retired. |
I'm doing this now :-( Most of it seems pretty straightforward - xDoc.NewXYZ instead of new XYZ. ToElement() instead of Element(), create a XMLPrinter to export an object to text, etc. The stumbling blocks come with the lack of Clone(), and the missing index parameters on Child(). The big warning is that XMLDocument.Parse returns the opposite of what it used to - 0 is now good, 0 in tinyXML1 was bad. |
Clone() is problematic; although writing a DeepClone() is on the list. (But still doesn't work quite the same.) The Child() index is (of course) fixable - it's just such a performance stumbling block. And Parse()...yeah. Sorry about that. But didn't want to keep persisting the irregularity. |
It was said earlier: I would very much appreciate a porting guide. I am struggling with the various API changes, such as XMLDeclaration. At the very least I think that there should be a prominent statement that there are significant API differences - it is not a drop-in replacement. |
I came here looking for an answer to the XMLDeclaration question, but since there isn't one:
|
In Tinyxml creating a declaration was like : TiXmlDeclaration xmlDecl = new TiXmlDeclaration("1.0", "UTF-8", "");
But in Tinyxml2 it requires to create a document first
tinyxml2::XMLDeclaration decl = doc.NewDeclaration();
decl->SetValue("xml version="1.0" encoding=""");
In tinyxml2, Do I need to do InsertEndChild after creating a new declaration?
The text was updated successfully, but these errors were encountered: