When I try

inNode->setTextContent(DOMStr("Paddy"));

I get an exception

And when I try

inNode->getFirstChild()->setTextContent(DOMStr("Paddy"));

I also get an exception.



-----Original Message-----
From: Gareth Reakes [mailto:[EMAIL PROTECTED] 
Sent: 06 June 2006 13:38
To: [email protected]
Subject: Re: setNodeValue not working

Hi,

        If you want to set the text content of the first child then do
what you 
suggest. If you want to set the text content of the node then call 
setTextContent on the node. Why don't you give it try and see which 
works for you?


Gareth

Mannion, Enda wrote:
> How do I use this setTextContent() function.
> 
> Something like this?
> 
> Node->getFirstChild()->setTextContent(DOMStr("NewText"));
> 
> 
> Enda
> 
> 
> -----Original Message-----
> From: Gareth Reakes [mailto:[EMAIL PROTECTED] 
> Sent: 06 June 2006 12:15
> To: [email protected]
> Subject: Re: setNodeValue not working
> 
> Hi,
> 
> Mannion, Enda wrote:
>> Hi,
>>
>>  
>>
>> In the code below setNodeValue is not updating the XML file with the
> new 
>> value.
>>
>>  
>>
>> Am I doing this correctly?
>>
>>  
>>
>> for(int k = 0; k<childlist->getLength(); k++)
>>
>> {
>>
>>       inNode = childlist->item(k);
>>
>>       if(DOMNode::ELEMENT_NODE == inNode->getNodeType())
>>
>>       {
>>
>>             char* nodeName =
> XMLString::transcode(inNode->getNodeName());
>>             if(strcmp(nodeName, szTag.c_str()) == 0)
>>
>>             {
>>
>>
> inNode->getFirstChild()->setNodeValue(DOMStr("Paddy"));
>>                   break;
>>
>>             }
>>
>>       }
>>
>> }
> 
> Thats not what you want to do. Take a look at
> 
> http://xml.apache.org/xerces-c/apiDocs/classDOMNode.html#_details
> 
> for what each of the name/value/attrs mean. If you want to set the 
> content check out setTextContent.
> 
> 
> Gareth
> 

-- 
Gareth Reakes, Managing Director           Embrace Mobile
+44-1865-811197              http://www.embracemobile.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to