|
Sorry to keep pestering on this one, But I just can’t get setTextContent
to work for me even when I cast it to an element. Is there anything else I need to do after
I call setTextContent to write the text to the XML file? My current call to setTextContent throws
an exception with code=9 = NOT_SUPPORTED_ERR. Enda From: Jesse Pelton
[mailto:[EMAIL PROTECTED] setTextContent isn't supported for
DOMNode, which is the class you're using. Try casting aNode to a DOMElement
pointer before calling setTextContent(). This is safe because you've already
checked that it really is an element node. ((DOMElement*)aNode)->setTextContent(DOMStr("New
Text")); From: Gareth, Is it possible for you to explain what you mean here?? > Yes it is common. Its likely because you are not
using on an element. > Not all node types can be set this way. Please. Can you give an example of what you are
telling me or even correct my code: DOMNodeList* list = docNode->getChildNodes(); DOMNode* aNode = NULL; for(int i = 0; i<list->getLength(); i++) { aNode = list->item(i); if(DOMNode::ELEMENT_NODE ==
aNode->getNodeType()) {
char* nodeName =
XMLString::transcode(aNode->getNodeName());
if(strcmp(nodeName, szTag.c_str()) == 0)
{
aNode->setTextContent(DOMStr("New Text")); // ß I want this to work
break;
} } } Also, I had exception handling code set and the
exception code returned was 9 = Not Supported Error Thanks, Enda
-----Original Message----- Hi, > Thanks, > > I have read the function spec and the exception
is of type DOMException, > > The msg content of the exception class was not
returned so I am not sure > if it refers to this > > DOMException NO_MODIFICATION_ALLOWED_ERR: Raised
when the node is > readonly. Have you tried catching the DOMException and looking
to see what type it is? > Is it possible to see a sample of
setTextContent() being called, surely > this is a very common function. Yes it is common. Its likely because you are not using
on an element. Not all node types can be set this way. > > Is this the standard way to update text in an XML
tag? This or add new children. Gareth -- Gareth Reakes, Managing
Director Embrace
Mobile +44-1865-811197
http://www.embracemobile.com --------------------------------------------------------------------- To unsubscribe, e-mail: For additional commands, e-mail:
[EMAIL PROTECTED] |
- RE: setNodeValue not working Jesse Pelton
- RE: setNodeValue not working Mannion, Enda
- RE: setNodeValue not working Jesse Pelton
