In your shoes, I'd fire up a debugger and see where the problem occurs.
But first, I'd modify my code to check the returns from functions that
return pointers to be sure they're valid before using them.  For
instance, parser->getDocument() can return NULL.  If it does, you'll
certainly crash when you call getDocumentElement(). 

> -----Original Message-----
> From: Sameera Perera [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, February 03, 2005 10:13 AM
> To: xerces-c-dev@xml.apache.org
> Subject: Problem with namespaces...
> 
> Hi,
> 
> I'm using Xerces-C 2.2.0
> Whenever I call functions such as getElementNS, getAttributeNS, 
> lookupNamespace etc.
> my VC++ 6/7.1 apps crash.
> The exception thrown isn't a type of XMLException either.
> What am I doing wrong? Pls help.
> 
> Sample of my code..
> //////////////////////////////////////////////////////
> // Using XSec library as well.
> XMLPlatformUtils::Initialize();
> 
> XercesDOMParser *parser = new XercesDOMParser();
> parser->setDoNamespaces(true);
> 
> MemBufInputSource* memIS = new MemBufInputSource ((const 
> XMLByte*) soapMsg, 
> (unsigned int) strlen(soapMsg), "WSS4C");
> parser->parse(*memIS);
> 
> DOMDocument* doc = parser->getDocument();
> try{
> 
> const XMLCh* prefix = 
> doc->getDocumentElement()->lookupNamespacePrefix(MAKE_UNICODE_
STRING("http://www.fabrikam123.com/payloads";), 
> true);
> 
> // Exception thrown.
> 
> 
> Regards,
> Sameera Perera. 
> 
> 
> ---------------------------------------------------------------------
> 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