tinyxml2 icon indicating copy to clipboard operation
tinyxml2 copied to clipboard

Not an issue but a question about copying a XMLElement

Open bigguiness opened this issue 1 year ago • 1 comments

I have bumbled my way along with using this library and everything has worked great.

Now I have a need to store a XMLElement from the document for processing later in my code.

In general my XML document looks like this (with simplified attributes): <tags> <tag> <data now=""/> <data now=""/> <default> <data extra=""/> <data extra=""/> </default> </tag> </tags>

The <tag><data ...> stuff is all working fine.

I want to copy the whole <default>...</default> part to something (maybe a XMLDocument in my class data?) so I can process it later when needed. Is this possible?

I tried this, thinking I would at least be able to print and view the copied element. But all I get is the printf() message: XMLElement *element ; element = tag_element->FirstChildElement("default"); if (element) { printf("tag has default data\n"); XMLDocument doc; element->DeepClone(&doc); doc.Print(); }

Any help would be appreciated.

bigguiness avatar Nov 22 '24 22:11 bigguiness