setNodeValue not working

G

Guest

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_MetaData"));
DOMElement* pElem = (DOMElement*)Info->item(0);

DOMNodeList *pList =
pElem->getElementsByTagName(XMLString::transcode(Key.c_str()));
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\windows\xpis\datastoreManager\test\12345\ClientManager.map;</attachments>
<numAttachments>3</numAttachments>
</IS_MetaData>

Thanks,
Enda
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top