Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   setNodeValue not working (http://www.velocityreviews.com/forums/t170176-setnodevalue-not-working.html)

keepyourstupidspam 11-14-2005 06:13 PM

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


keepyourstupidspam 11-15-2005 12:29 PM

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


Martin Honnen 11-15-2005 01:36 PM

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.


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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57