Skip to content
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

Not an issue but a question about copying a XMLElement #1006

Open
bigguiness opened this issue Nov 22, 2024 · 0 comments
Open

Not an issue but a question about copying a XMLElement #1006

bigguiness opened this issue Nov 22, 2024 · 0 comments

Comments

@bigguiness
Copy link

bigguiness commented Nov 22, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant