[jdom-interest] Additional namespace issues
Elliotte Rusty Harold
elharo at metalab.unc.edu
Mon Dec 18 05:36:41 PST 2000
At 11:01 AM -0800 12/15/00, Jason Hunter wrote:
>> I'd actually like to propose a more radical shift, though I'm not the
>> first to propose this idea. It has been brought up before.
>>
>> Instead of (or perhaps in addition to) getAdditionalNamespaces()
>> there should be a getNamespacesInScope() method that returns a list
>> of all the namespaces which apply to that element. This is what's
>> needed for resolving namespace prefixes in attribute values, for
>> example.
>
>Hmm... We ourselves don't need to resolve namespace prefixes on attrib
>values, correct? So what's the use case for this new method?
>
I'm sorry. I must have been asleep. What I asked for is not what I
wanted at all, and I agree it makes no sense. What I should have
asked for, and what had been asked for before, were methods like this:
public Namespace getNamespace(String prefix)
In other words, when I encounter a namespace prefix in an attribute
value as happens in XSLT, Schemas, and probably elsewhere I can ask
what that prefix is mapped to in the context of the current element.
This may moving up the tree, though often not all the way to the
root. I should also have a method like this:
public Namespace getDefaultNamespace()
simply to find out what namespace applies to unprefixed names. I
don't need methods that get a list of these things.
>> The only real need for getAdditionalNamespaces() is for XMLOutputter.
>
>DOMOutputter and SAXOutputter too.
>
Yes, but still just for output. I keep thinking there's got to be a
good way to keep this from being exposed outside the org.jdom.output
package. In any case, even if we do keep it public like now, this
method doesn't address the need for a straightforward way of finding
out what namespace is mapped to a given prefix and what the default
namespace is.
--
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| The XML Bible (IDG Books, 1999) |
| http://metalab.unc.edu/xml/books/bible/ |
| http://www.amazon.com/exec/obidos/ISBN=0764532367/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://metalab.unc.edu/javafaq/ |
| Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/ |
+----------------------------------+---------------------------------+
More information about the jdom-interest
mailing list