Hello, Jesse.
Thanks a lot for help. Following working fine:
static const XMLCh gLS[] = { chLatin_L, chLatin_S, chNull };
DOMImplementation *impl =
DOMImplementationRegistry::getDOMImplementation(gLS);
// create an empty document with DTD, xsl
DOMDocumentType* dt = impl->createDocumentType(_T("metadata"),
NULL, _T("my.dtd"));
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* doc =
impl->createDocument(NULL, NULL, dt);
DOMProcessingInstruction* procInstruction =
doc->createProcessingInstruction(_T("xml-stylesheet"),
_T("type=\"text/xsl\" href=\"my.xsl\""));
doc->appendChild(procInstruction);
About dtd: it should be some more easy way to handle required fields
then putting it by hands:
doc->appendChild(doc->createElement());
Cheerse!
gok
-----Original Message-----
From: Jesse Pelton [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 06, 2007 4:43 AM
To: [email protected]
Subject: RE: newbie question: how to create empty xml from DTD
If you want to create a sort of template document that includes, say,
any required elements in the DTD, Xerces provides no convenient method.
If you just want to create an instance document that refers to your DTD
and has an xml-stylesheet processing instruction, you'll need to call
DOMImplementation::getImplementation() to get an implementation pointer,
then use DOMImplementation::createDocumentType() to create a document
type that you then pass to DOMImplementation::createDocument(). You
should be able to create the processing instruction node using
DOMDocument::createProcessingInstruction() and append it with
DOMNode::appendChild(). You'll probably want to use
DOMDocument::getDocumentElement() to get the document's root element.
-----Original Message-----
From: Gennady Khokhorin [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 05, 2007 5:53 PM
To: [email protected]
Subject: newbie question: how to create empty xml from DTD
Hello, all.
I started shaking Xerces and can not figure out how to create an empty
xml from DTD file?
Also in addition to .dtd I want to include <?xml-stylesheet node. How I
can do it?
Thank you for advice.
Gennady
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]