Isn't there a dom4j API call to get the namespace URI's from the XML
file and bind them into your xpath expression?

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Tom Oehser
Sent: Tuesday, February 26, 2002 11:12 PM
To: James Strachan
Cc: bob mcwhirter; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: Re: [dom4j-user] default namespace issue



I figured out why I was getting different results with Xalan and dom4j,
it
had to do with some parsers defaulting to namespace aware and others
not.

> Or you can bind your namespace URI to some prefix of your choice and
have a
> much nicer expression.
>
> my:one/my:two/@three
>
> So in other words, when dealing with namespaces its good to use
prefixes in

Unfortunately, I don't have any control over the xml or the DTD, nor
even
certainty of exactly what URI will be in use when it runs in production.

I know I could transform it first, but the whole reason I got started on
this was to avoid having 15 levels of DOM code iterating through nodes
and
casting back to Elements.  I'll just end up with *[name()= on every
level.

I have a spec that specifies all the elements, and says there will be a
particular default namespace and a prefix, and I have sample and test
documents from several sources which do *not* match the spec, but do
have
a default namespace, but no prefix, and I have suggestions from other
groups that they may or may not drop the default namespace or change it,
and I have another default namespace under the XML-DSIG stuff, which is
probably not going to change.  And I have to create classes and deliver
iterations _now_.  So, I really do have to write code that ignores the
namespaces, and it really is the most stable and trustworthy thing to
do,
for these particular documents, until the industry groups and other
departments get their act together.

-Tom



_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user



_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to