![]() |
setNodeValue not working
Can anyone please tell me why this code is not working for me. I can
add the error handling again, XML file is below. I want to change the currentState element from pending to Submitted. int DataStore::UpdateMetaData1(string SubmissionID, string Key, string Value) { XercesDOMParser* parser = new XercesDOMParser(); parser->setValidationScheme(XercesDOMParser::Val_Never) ; // optional. parser->setDoNamespaces(true); // optional string metadataFile = GetMetadataFileName(SubmissionID); parser->parse(metadataFile.c_str()); xercesc_2_4::DOMDocument* m_document = parser->getDocument(); DOMNodeList* Info = m_document->getElementsByTagName(XMLString::transcode("IS_Met aData")); DOMElement* pElem = (DOMElement*)Info->item(0); DOMNodeList *pList = pElem->getElementsByTagName(XMLString::transcode(Key.c_s tr())); if( pList->getLength() > 0 ) { DOMElement *pElem = (DOMElement *)pList->item( 0 ); DOMNode *pChild = pElem->getFirstChild(); if( pChild ) { pChild->setNodeValue(XMLString::transcode(Value.c_str())) ; } } return A_OK; } <IS_MetaData> <submissionID>12345</submissionID> <SubmissionDate>11 14 2005</SubmissionDate> <submissionType>Whatever</submissionType> <description>Test Incident</description> <currentState>Pending</currentState> <annotations>Testing the data store manager</annotations> <workflowID>0</workflowID> <business>automobile</business> <deviceName>Minime</deviceName> <deviceIP>18.289.134.252</deviceIP> <submissionDataFile>0</submissionDataFile> <attachments>S:\IS\A.05.00\dev\main\src\client\win dows\xpis\datastoreManager\test\12345\ClientManage r.map;</attachments> <numAttachments>3</numAttachments> </IS_MetaData> Thanks, Enda |
Re: setNodeValue not working
>From a similar example I was reading the above code only sets the value
in memory can someone tell me how I can set it in the file persistantly. Thanks, Enda |
Re: setNodeValue not working
keepyourstupidspam wrote: >>From a similar example I was reading the above code only sets the value > in memory can someone tell me how I can set it in the file > persistantly. DOMWriter should help with that: <http://xml.apache.org/xerces-c/apiDocs/classDOMWriter.html> -- Martin Honnen http://JavaScript.FAQTs.com/ |
| All times are GMT. The time now is 08:13 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.