I had the same problem, and I've solved it by having a skeleton XML
document in memory. I initialise the new document by parsing the skeleton
document in a MemBufInputSource and then append / insert any nodes I need in
that new document.
Here's sopme example code:
// In-memory template for empty XML files
const char* Template =
"\
<?xml version=\"1.0\"?>\n\
<!DOCTYPE MY_DTD SYSTEM \"my_dtd.dtd\">\n\
<MY_DTD version=\"0.0\">\n\
</MY_DTD>\n\
";
MemBufInputSource memBuf(
(const XMLByte*)Template
, strlen(Template)
, "template"
, false
);
DOMParser parser;
parser.setCreateEntityReferenceNodes(true);
parser.setToCreateXMLDeclTypeNode(true);
parser.parse(memBuf);
DOM_Document newDoc = parser.getDocument();
// I now have a valid MY_DTD document that I can modify and print.
Hope this helps, Evert
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]