xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
Re: [XOM-interest] Getting the prefix of a namespace knowing the URI
- From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
- To: Laurent Bihanic <laurent.bihanic AT atosorigin.com>, XOM-interest <XOM-interest AT lists.ibiblio.org>
- Subject: Re: [XOM-interest] Getting the prefix of a namespace knowing the URI
- Date: Fri, 7 Feb 2003 12:23:42 -0500
At 1:45 PM +0100 2/7/03, Laurent Bihanic wrote:
public String getNamespacePrefix(String uri) {
There's another problem with this suggested method: there's no guarantee there's only one prefix for this URI. There's not even any guarantee there's only one prefix used on the current element. Providing an XPath like namespaces in scope requires using the prefixes to iterate rather than the URI because there's a many-to-one relationship between the prefixes and the URIs.
Right now my thinking is to allow an iteration across all locally declared namespaces (including ones implicitly declared by the element and its attributes) through getNamespacePrefix(int i) and getNamespaceDeclarationCount(). I could shift that to namespaces in scope if there seemed to be a need but right now I don't see much of a need for that.
--
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo AT metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| Processing XML with Java (Addison-Wesley, 2002) |
| http://www.cafeconleche.org/books/xmljava |
| http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.cafeconleche.org/ |
+----------------------------------+---------------------------------+
-
[XOM-interest] Getting the prefix of a namespace knowing the URI,
Laurent Bihanic, 02/07/2003
-
Re: [XOM-interest] Getting the prefix of a namespace knowing the URI,
Elliotte Rusty Harold, 02/07/2003
-
Re: [XOM-interest] Getting the prefix of a namespace knowing the URI,
Laurent Bihanic, 02/07/2003
-
Re: [XOM-interest] Getting the prefix of a namespace knowing the URI,
Elliotte Rusty Harold, 02/07/2003
-
Re: [XOM-interest] Getting the prefix of a namespace knowing the URI,
Laurent Bihanic, 02/17/2003
- Re: [XOM-interest] Getting the prefix of a namespace knowing the URI, Elliotte Rusty Harold, 02/17/2003
-
Re: [XOM-interest] Getting the prefix of a namespace knowing the URI,
Laurent Bihanic, 02/17/2003
-
Re: [XOM-interest] Getting the prefix of a namespace knowing the URI,
Elliotte Rusty Harold, 02/07/2003
-
Re: [XOM-interest] Getting the prefix of a namespace knowing the URI,
Laurent Bihanic, 02/07/2003
- Re: [XOM-interest] Getting the prefix of a namespace knowing the URI, Elliotte Rusty Harold, 02/07/2003
-
Re: [XOM-interest] Getting the prefix of a namespace knowing the URI,
Elliotte Rusty Harold, 02/07/2003
Archive powered by MHonArc 2.6.24.