Skip to content

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

@bigguiness

Description

@bigguiness

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions