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 "Dennis@work" <da...@yahoo.com> on 2000/09/27 21:40:04 UTC

Namespace problem

Hi,

I am using Xerces-c version 1.2 on Solaris 2.6 with the Sun Workshop 4.2
compiler.
I am having a problem with getElementByTagNameNS().

I create my DOM tree with the following xml:

<Derived xmlns:foo="http://Derived" Version="1" ChangedDataOnly="no" >
   <foo:DerivedLong>555</foo:DerivedLong>
   <foo:DerivedDouble>555.123456789</foo:DerivedDouble>
   <foo:DerivedString>DerivedString</foo:DerivedString>
</Derived>

I then try to get the DerivedLong element with:

       nodeList =
ocument.getElementsByTagNameNS( DOMString("http:/Derived"),
DOMString("DerivedLong") );

I got back 0 elements so then I tried this:

    DOM_NodeList nodeList =
ument.getElementsByTagName( 
      DOMString("foo:DerivedLong")); 
<snip> 
    DOM_Node node = nodeList.item(0); 
    // print out node info... 
    cout << "NodeName: " << node.getNodeName() << endl; 
    cout << "NamespaceURI: " << node.getNamespaceURI() << endl; 
    cout << "Prefix: " << node.getPrefix() << endl; 
    cout << "LocalName: " << node.getLocalName() << endl; 

and I get the output: 

    NodeName: foo:DerivedLong 
    NamespaceURI: 
    Prefix: 
    LocalName: 

so NamespaceURI, Prefix and LocalName did not get set. 

I have also tried this without the "foo" prefix and getElementByTagNameNS() again returned 0 elements. 

I looked at the test code and it is creating the document with doc.createElementNS() methods where the namespaceURI is always passed in. 

Am I doing something wrong here?
Has anyone got namespaces to work when the namespace is specified in the XML? 

Thanks for your help, 

Dennis Doussan 
Nielsen Media Research 




Re: Namespace problem

Posted by "Dennis@work" <da...@yahoo.com>.
As far as I know, Xerces-C does not depend on C++ namespaces for anything.

RE: Namespace problem

Posted by Feng Xia <FX...@netpcs.com>.
I tried to compiler 1.2 on solaris 2.8 using CC 5.0. It seemed CC could not
pass "runConfigure". Any idea?

Thanks,
Feng

-----Original Message-----
From: xerces-c-dev-return-2326-fxia=netpcs.com@xml.apache.org
[mailto:xerces-c-dev-return-2326-fxia=netpcs.com@xml.apache.org]On
Behalf Of Thomas Norton
Sent: Wednesday, September 27, 2000 3:50 PM
To: xerces-c-dev@xml.apache.org
Subject: Re: Namespace problem


As far as I know, the Workshop 4.x CC compiler does not support namespaces.
You will unfortunately have to upgrade to Workshop5.x in order to get ANSI
and namespace support for the CC compiler.
- Tom

----- Original Message -----
From: "Dennis@work" <da...@yahoo.com>
To: <xe...@xml.apache.org>
Sent: Wednesday, September 27, 2000 3:40 PM
Subject: Namespace problem


> Hi,
>
> I am using Xerces-c version 1.2 on Solaris 2.6 with the Sun Workshop 4.2
> compiler.
> I am having a problem with getElementByTagNameNS().
>
> I create my DOM tree with the following xml:
>
> <Derived xmlns:foo="http://Derived" Version="1" ChangedDataOnly="no" >
>    <foo:DerivedLong>555</foo:DerivedLong>
>    <foo:DerivedDouble>555.123456789</foo:DerivedDouble>
>    <foo:DerivedString>DerivedString</foo:DerivedString>
> </Derived>
>
> I then try to get the DerivedLong element with:
>
>        nodeList =
> ocument.getElementsByTagNameNS( DOMString("http:/Derived"),
> DOMString("DerivedLong") );
>
> I got back 0 elements so then I tried this:
>
>     DOM_NodeList nodeList =
>
nt.getElementsByTagName(
>       DOMString("foo:DerivedLong"));
> <snip>
>     DOM_Node node = nodeList.item(0);
>     // print out node info...
>     cout << "NodeName: " << node.getNodeName() << endl;
>     cout << "NamespaceURI: " << node.getNamespaceURI() << endl;
>     cout << "Prefix: " << node.getPrefix() << endl;
>     cout << "LocalName: " << node.getLocalName() << endl;
>
> and I get the output:
>
>     NodeName: foo:DerivedLong
>     NamespaceURI:
>     Prefix:
>     LocalName:
>
> so NamespaceURI, Prefix and LocalName did not get set.
>
> I have also tried this without the "foo" prefix and
getElementByTagNameNS() again returned 0 elements.
>
> I looked at the test code and it is creating the document with
doc.createElementNS() methods where the namespaceURI is always passed in.
>
> Am I doing something wrong here?
> Has anyone got namespaces to work when the
 namespace is specified in the XML?
>
> Thanks for your help,
>
> Dennis Doussan
> Nielsen Media Research
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>


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


Re: Namespace problem

Posted by Thomas Norton <to...@ndtechnologies.com>.
As far as I know, the Workshop 4.x CC compiler does not support namespaces.
You will unfortunately have to upgrade to Workshop5.x in order to get ANSI
and namespace support for the CC compiler.
- Tom

----- Original Message -----
From: "Dennis@work" <da...@yahoo.com>
To: <xe...@xml.apache.org>
Sent: Wednesday, September 27, 2000 3:40 PM
Subject: Namespace problem


> Hi,
>
> I am using Xerces-c version 1.2 on Solaris 2.6 with the Sun Workshop 4.2
> compiler.
> I am having a problem with getElementByTagNameNS().
>
> I create my DOM tree with the following xml:
>
> <Derived xmlns:foo="http://Derived" Version="1" ChangedDataOnly="no" >
>    <foo:DerivedLong>555</foo:DerivedLong>
>    <foo:DerivedDouble>555.123456789</foo:DerivedDouble>
>    <foo:DerivedString>DerivedString</foo:DerivedString>
> </Derived>
>
> I then try to get the DerivedLong element with:
>
>        nodeList =
> ocument.getElementsByTagNameNS( DOMString("http:/Derived"),
> DOMString("DerivedLong") );
>
> I got back 0 elements so then I tried this:
>
>     DOM_NodeList nodeList =
>
nt.getElementsByTagName( 
>       DOMString("foo:DerivedLong")); 
> <snip> 
>     DOM_Node node = nodeList.item(0); 
>     // print out node info... 
>     cout << "NodeName: " << node.getNodeName() << endl; 
>     cout << "NamespaceURI: " << node.getNamespaceURI() << endl; 
>     cout << "Prefix: " << node.getPrefix() << endl; 
>     cout << "LocalName: " << node.getLocalName() << endl; 
> 
> and I get the output: 
> 
>     NodeName: foo:DerivedLong 
>     NamespaceURI: 
>     Prefix: 
>     LocalName: 
> 
> so NamespaceURI, Prefix and LocalName did not get set. 
> 
> I have also tried this without the "foo" prefix and getElementByTagNameNS() again returned 0 elements. 
> 
> I looked at the test code and it is creating the document with doc.createElementNS() methods where the namespaceURI is always passed in. 
> 
> Am I doing something wrong here?
> Has anyone got namespaces to work when the
 namespace is specified in the XML?
>
> Thanks for your help,
>
> Dennis Doussan
> Nielsen Media Research
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>