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:OMDocument* 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
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:OMDocument* 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