You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Rupanu Ranjaneswar <ru...@yahoo.com> on 2009/07/22 10:53:15 UTC

newbie : DOMDocument from XML File

hey I just got started off with Xerces-c. I'm trying to create a DomDocument from the XML file I have.I'm doing the following../////XercesDOMParser* itsParser = new XercesDOMParser(); DOMDocument* domdoc = pDOMImpl->createDocument(NULL, NULL, NULL);itsParser->parse("XMLFile.xml"); domdoc = itsParser->getDocument();////1)I want to know is there any other way to get DomDocument directly from an XML String?2)After parsing I again write it to a file XMLFile1.xmlXMLFile1.xml file shows encoding=UTF-16, is there any way to convert it to UTF-8 or set default encoding to UTF-8 for DOMLSSerializer?
///////Here is how I get the string to write////
pDOMImpl = DOMImplementationRegistry::getDOMImplementation(L"LS");pSerializer = ((DOMImplementationLS*)pImplement)->createLSSerializer();	//MemoryManager 	 XMLCh* str =  pSerializer->writeToString(pDOMDocument);	 String temp = (String)XMLString::transcode(str);