You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Rajesh Chilambi <rc...@bnx.com> on 2004/03/25 21:40:38 UTC

Question

Hi,
  I have the following code

	xercesc::XMLPlatformUtils::Initialize();
    xercesc::MemBufInputSource* memBufIS = new xercesc::MemBufInputSource
    (
        (const XMLByte*)gXMLInMemBuf
        , strlen(gXMLInMemBuf)
        , gMemBufId
        , false
    );

	xercesc::XercesDOMParser* domParser = new xercesc::XercesDOMParser();
	domParser->parse(*memBufIS);
	xercesc::DOMDocument* doc = domParser->getDocument();
	domParser->setDoNamespaces(true);
	xercesc::DOMNode* ele = (xercesc::DOMNode*)doc->getDocumentElement();
	wchar_t* p = (wchar_t*)ele->getLocalName();
	wchar_t* p1 = (wchar_t*)ele->getPrefix();
	wchar_t* p2 = (wchar_t*)ele->getNodeName();
	wchar_t* p3 = (wchar_t*)ele->getNamespaceURI();	

The DOMNode in question is like this <soap:envelope> ... </soap:envelope>
getLocalName, getprefix and getnamespaceuri all return empty strings.  Only getNodeName returns me "soap:envelope".  If someone can tell me why getLocalname, getprefix and getnamespaceuri don't return me correct values, i would appreciate it.

Thanx in advance
Rajesh

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: Question

Posted by Gareth Reakes <pa...@parthenoncomputing.com>.
Hi,
	you need to tell the parser that you want to use namespaces. Take
a look in the docs or samples.

Gareth


On Thu, 25 Mar 2004, Rajesh Chilambi wrote:

> Hi,
>   I have the following code
>
> 	xercesc::XMLPlatformUtils::Initialize();
>     xercesc::MemBufInputSource* memBufIS = new xercesc::MemBufInputSource
>     (
>         (const XMLByte*)gXMLInMemBuf
>         , strlen(gXMLInMemBuf)
>         , gMemBufId
>         , false
>     );
>
> 	xercesc::XercesDOMParser* domParser = new xercesc::XercesDOMParser();
> 	domParser->parse(*memBufIS);
> 	xercesc::DOMDocument* doc = domParser->getDocument();
> 	domParser->setDoNamespaces(true);
> 	xercesc::DOMNode* ele = (xercesc::DOMNode*)doc->getDocumentElement();
> 	wchar_t* p = (wchar_t*)ele->getLocalName();
> 	wchar_t* p1 = (wchar_t*)ele->getPrefix();
> 	wchar_t* p2 = (wchar_t*)ele->getNodeName();
> 	wchar_t* p3 = (wchar_t*)ele->getNamespaceURI();
>
> The DOMNode in question is like this <soap:envelope> ... </soap:envelope>
> getLocalName, getprefix and getnamespaceuri all return empty strings.  Only getNodeName returns me "soap:envelope".  If someone can tell me why getLocalname, getprefix and getnamespaceuri don't return me correct values, i would appreciate it.
>
> Thanx in advance
> Rajesh
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>

-- 
Gareth Reakes, Managing Director            +44-1865-811184
Parthenon Computing                http://www.parthcomp.com




---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org