[jdom-interest] Is JDOM dying?

Malachi de AElfweald malachi at tremerechantry.com
Mon Mar 17 08:35:20 PST 2003


Well, inherit and any don't really mean the same thing...

I see there being four possible meanings:
new Element("foo", Namespace.NONE)
new Element("foo", Namespace.ANY)
new Element("foo", Namespace.INHERIT) // or null
new Element("foo", someOtherNS);

Following the way most Java APIs work, and the textual representation
of XML, the 3rd would be the one exected from not passing any namespace ---
ie: new Element("foo") should not add a namespace declaration. But, in fact
it does, because JDOM does the first... So, by NOT passing a Namespace to
the constructor, JDOM adds ns="" to the output...  That is the root of this
entire conversation.  There needs to be a way to say 
DONT_ADD_ANYTHING_EXTRA.
Defaults are fine, but if you are going to default to something that 
doesn't
match the output, you need a way to override it.

Malachi


On Sun, 16 Mar 2003 11:48:17 -0800, Jason Hunter <jhunter at servlets.com> 
wrote:

> There's two ways to look at an XML model.  One is classes which simulate
> the XML text representation.  Another is classes which simulate the
> fundamental structure and meaning of the XML.  JDOM has decided to model
> the meaning, not the text, and has done so correctly.  We're not going
> to change.
>
> We chose to model the "meaning" for many reasons.  There are arguments
> for going the other way, but they weren't (and still aren't) as
> compelling.
>
> Now, I do think within the "meaning" model it would be handy to have an
> elt.getChild("foo") that didn't require always passing in the same old
> namespace like elt.getChild("foo", SAMEOLDNS).  That's what trips up
> most people.  Unfortunately we shouldn't treat no namespace the same way
> as a parent namespace.  It's inconsistent.  One option is to have a
> wildcard like elt.getChild("foo", ANY) which follows the XQuery (XPath?)
> precedent of using a * to match any namespace such as
> /*:foo/*:bar/text().  But is ANY better than SAMEOLDNS?  Not really.
>
> -jh-
>
>



-- 
 



More information about the jdom-interest mailing list