I am looking for a way to handle this. Does the XercesDOMParser throw an exception if the node DOMNode* x; x->getData() is empty. How can I handle the Segmentation Fault when the parser comes across unexpected data?
Thanks, Raymond -----Original Message----- From: Steele, Raymond Sent: Monday, January 24, 2011 5:36 PM To: '[email protected]' Subject: RE: EXTERNAL: Re: DOMNode::getTextContent() Thanks for providing some hint of direction. I have found that if any of the text nodes do not contain content, the program dumps. I think I need to place a check in there. Raymond -----Original Message----- From: John Snelson [mailto:[email protected]] Sent: Friday, January 21, 2011 7:22 AM To: [email protected] Subject: Re: EXTERNAL: Re: DOMNode::getTextContent() You've shown us nothing that would cause a segfault, and you've not even given us a stack trace of where the segfault occurs. Help us to help you... John On 21/01/11 01:19, Steele, Raymond wrote: > I'm still struggling with this segmentation fault. Can anyone shed some > light? Thanks! > > Raymond > > > -----Original Message----- > From: Steele, Raymond > Sent: Wednesday, January 19, 2011 8:59 AM > To: '[email protected]' > Subject: RE: EXTERNAL: Re: DOMNode::getTextContent() > > Thanks, I was able to get it to work with: > > char* nodename = XMLString::transcode(list->getNodeName()); > char* text = XMLString::transcode(list->getFirstChild()->getTextContent()); > cout<< nodename<< ": "<< text<< endl;; > XMLString::release(&nodename); > XMLString::release(&text); > > Everything displays to STDOUT, however, I am getting a segmentation fault at > the end of the output. I am not sure why, does anything stand out? > > Raymond > > > -----Original Message----- > From: Alberto Massari [mailto:[email protected]] > Sent: Friday, January 14, 2011 11:16 AM > To: [email protected] > Subject: Re: EXTERNAL: Re: DOMNode::getTextContent() > > getTextContent() returns an XMLCh*, that "cout::operator<<" doesn't > handle. You need to transcode it into const char* > > Alberto > > On 1/14/2011 6:58 PM, Steele, Raymond wrote: >> Thanks for responding, and sorry about that. That was a typo. I forgot to >> add the parenthesis in the email. Even with the parenthesis, I am not >> getting what I expect from the getTextContent(). >> >> version xerces-C++ 3.1.0 >> Taking the following code: >> >> DOMDocument* doc = parserName->getDocument(); >> DOMNodeList* list = doc->getElementByTageName(X("S_RPS")); >> DOMNode* node = list->item(0)->getFirstChild(); >> cout<< node->getNodeType()<< endl; >> cout<< node->getTextContent()<< endl; >> >> The output: >> 3 >> 92dc648 >> >> >> >> Raymond >> >> >> -----Original Message----- >> From: PB [mailto:[email protected]] >> Sent: Thursday, January 13, 2011 4:17 PM >> To: [email protected] >> Subject: EXTERNAL: Re: DOMNode::getTextContent() >> >> On Thu, Jan 13, 2011 at 11:13 PM, Steele, Raymond >> <[email protected]> wrote: >>> Can someone help me out with this? >>> >>> version xerces-C++ 3.1.0 >>> Taking the following code: >>> >>> DOMDocument* doc = parserName->getDocument(); >>> DOMNodeList* list = doc->getElementByTageName(X("S_RPS")); >>> DOMNode* node = list->item(0)->getFirstChild(); >>> cout<< node->getNodeType()<< endl; >>> cout<< node->getTextContent<< endl; >>> >>> The output: >>> 3 >>> 92dc648 >>> >>> Question: If node is of type '3' (TEXT_NODE), how come I keep receiving >>> what looks like a memory address. I cannot seem to get the correct >>> information from the document. >> You're not calling the getTextContent method. Put parathenses: >> getTextContent(). >> >> Regards, >> >> Pete >> >
