Search code examples
c++xmlpugixml

Is there a way to read with library pugixml an xml containing another xml?


I have been using the c++ xml parser pugixml for a long time. However, now I want to insert an xml inside another one.

I have tried both with XInclude and external entity, but on both cases the xml_node is not correctly read from pugixml. So my question is: is there any way I can include an xml file inside another and being able to read the nodes in C++ with pugixml?


Solution

  • As you have figured out, pugixml doesn't support XInclude and ENTITY tags yet.

    You have to code this in your Library or Application. When you get a xml_node named xi:include, use its href property, open that file and parse it with pugixml. Then replace or add it to the xi:include node of the base xml_document.