1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
DOMBuilder* parser = ((DOMImplementationLS*)m_xmlImpl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0);
const char* gXMLInMemBuf = m_strValue;
MemoryManager* Manager = XMLPlatformUtils::fgMemoryManager;
MemBufInputSource* memBufIS = new MemBufInputSource((const XMLByte*)gXMLInMemBuf, strlen(gXMLInMemBuf), "test", false,Manager );
Wrapper4InputSource *InputSource= new Wrapper4InputSource (memBufIS,false);
domdoc = parser->parse(*InputSource);
XMLCh tempStr[LENGTH_TEMPORAL_STRING];
CString strNomRuta = "RecCmd";
XMLString::transcode(strNomRuta, m_xmlChTempStr, (LENGTH_TEMPORAL_STRING_3 - 1));
m_xmlDoc = m_xmlImpl->createDocument(0, m_xmlChTempStr, 0);
DOMElement* RecCmd = m_xmlDoc->getDocumentElement();
XMLString::transcode("version", m_xmlChTempStr, (LENGTH_TEMPORAL_STRING_3 - 1));
XMLString::transcode(VERSIO_XML_REC_CMD, tempStr, (LENGTH_TEMPORAL_STRING_3 - 1));
DOMAttr* attr = m_xmlDoc->createAttribute(m_xmlChTempStr);
attr->setValue(tempStr);
RecCmd->setAttributeNode(attr);
DOMNode* domnode = domdoc->getDocumentElement();
DOMNode* newRoot = m_xmlDoc->importNode(domnode, true);
DOMNodeList * ListNodes = newRoot->getChildNodes();
XMLSize_t NbrCount = ListNodes->getLength();
DOMNode* TheNode = NULL;
for(XMLSize_t i =0; i<NbrCount ;i++)
{
TheNode = ListNodes->item(0);
if(TheNode!=NULL)
{
m_xmlDoc->getDocumentElement()->appendChild(TheNode);
}
} |
Partager