You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Mathias Laguerie <ma...@softeam.fr> on 2002/09/03 15:59:12 UTC
Namespace
Hi,
I want to parse a document with namespace
Here it is the code I use
DOMParser parser = new DOMParser();
parser.setFeature(
"http://xml.org/sax/features/namespaces",
true);
true);
InputSource is = new InputSource(fis[0]);
parser.parse(is);
Document doc = parser.getDocument();
NodeList elementsDeclares = doc.getElementsByTagNameNS("xs","element");
System.out.println("" + ((Element)elementsDeclares.item(0)).getNodeName());
I doesn't work : elementsDeclares is null.
anybody has an idea ?
Mathias
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Namespace
Posted by Mathias Laguerie <ma...@softeam.fr>.
Of course,
thank you Elena
Mathias Laguérie
At 16:15 03/09/02 -0400, you wrote:
>Mathias Laguerie wrote:
> > NodeList elementsDeclares =
> doc.getElementsByTagNameNS("xs","element");
>.. [skip] ..
> > I doesn't work : elementsDeclares is null.
>
>I suspect "xs" is a prefix of the "element" -- not the namespace.
>By definition the first parameter of this function is namespace:
>http://www.w3.org/TR/2002/WD-DOM-Level-3-Core-20020409/core.html#ID-getElBTNNS
>
>Thanks,
>--
>Elena Litani / IBM Toronto
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
>For additional commands, e-mail: xerces-j-user-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Namespace
Posted by Elena Litani <el...@ca.ibm.com>.
Mathias Laguerie wrote:
> NodeList elementsDeclares = doc.getElementsByTagNameNS("xs","element");
.. [skip] ..
> I doesn't work : elementsDeclares is null.
I suspect "xs" is a prefix of the "element" -- not the namespace.
By definition the first parameter of this function is namespace:
http://www.w3.org/TR/2002/WD-DOM-Level-3-Core-20020409/core.html#ID-getElBTNNS
Thanks,
--
Elena Litani / IBM Toronto
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org