Hi all,

I'm trying to create a DOM document and then print
this document out as a string.  I followed the
examples from the "CreateDOMDocument" and the
"DOMPrint" code, and I have some questions below that
I hope someone can enlighten me:

1. What does this line do, especially with the "Core"
value?  
DOMImplementation *impl =
DOMImplementationRegistry::getDOMImplementation(XMLString::transcode("Core"));

2. What does XMLString::transcode("...") do, and why
is it needed?

3. What is the advantage of creating your own XML
document using the Xerces CreateDocument API versus
just encoding the XML string manually?  I'm new to
XML, and to be honest, I don't quite see the advantage
of creating your own document.  It seems much easier
to encode the string manually.  In both cases, you
would need to know the structure of the tree.

Thanks for your time and help.

Regards,
Monica


My code snippet below:

DOMImplementation *impl =
DOMImplementationRegistry::getDOMImplementation(XMLString::transcode("Core"));

DOMDocument *mydoc =
impl->createDocument(0,XMLString::transcode("company"),0);
DOMElement *rootElem = mydoc->getDocumentElement();
DOMElement *prodElem =
mydoc->createElement(XMLString::transcode("product"));
rootElem->appendChild(prodElem);
DOMText *prodDataVal =
mydoc->createTextNode(XMLString::transcode("Xerces-C"));
   prodElem->appendChild(prodDataVal);

DOMWriter *writer = impl->createDOMWriter();
cout <<
XMLString::transcode(writer->writeToString(*mydoc)) <<
endl;

delete writer;
mydoc->release();


__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to