Hi!

> In older version (1.6 etc) a namespace context was created by walking
> the element hierarchy and picking the namespaces that were defined in
> the element that is the context of the xpath statement

I do not see this in 1.6.1 but I think it would not be enough if it is
there. The xpath expression could be of any complexity and could try to
select nodes in all other branches of the document and in deeper of the
actual with own namespace declarations, too. And this branches have
other namespace declarations and maybe the prefixes would be the same
with other URIs or there are default namespaces without prefixes, that
need to be changed (added with prefix).

There is no method to get all namespaces that are defined in the
document. So this is what I have added. In many cases it would be enough
to add namespaces unchanged to the xpath expression. But in the
situations above it is needed to change prefixes of some namespace
definitions that should be added to the context and this is done, too.
The xpath need to use this new prefixes - there is no code in the moment
to automatically change some pathes, because this might be extreme
complex. Again the xpath could be of any complexity.

As an example try come xpathes with this xml:

<OOO xmlns="http://zvon.org/xnumber";
xmlns:lower="http://zvon.org/lowercase"; ooo="222">
  <aaa>
    <lower:BBB xmlns:lower="http://zvon.org/uppercase";>
      <lower:x111/>
      <sss xmlns:lower="http://zvon.org/xnumber";>
        <lower:x111/>
      </sss>
    </lower:BBB>
    <lower:x111/>
  </aaa>
  <aaa xmlns="http://zvon.org/uppercase";>
    <BBB xmlns:upper="http://zvon.org/uppercase"; upper:U="A" U="A"
lower:U="A"></BBB>
  </aaa>
  <aaa xmlns="http://zvon.org/lowercase";>
    <upper:BBB xmlns:upper="http://zvon.org/uppercase";
xmlns="http://zvon.org/xnumber";>
      <x111/>
    </upper:BBB>
    <x111/>
  </aaa>
</OOO>

-- 
Viele Grüße / best regards

Marc Pellmann (Software Architect)

inubit - integrating your business and IT
inubit AG
Schöneberger Ufer 89-91
D-10785 Berlin
Fon: +49.30. 72 61 12-132
Fax: +49.30. 72 61 12-100
Freecall: 0800-go inubit
Web: www.inubit.com

Vorstand: Dr. Torsten Schmale
Vorsitzender des Aufsichtsrates: Dr. Wolf-Dieter Klemt
Registergericht: AG Charlottenburg
Registernummer: HRB 80154
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
dom4j-dev mailing list
dom4j-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-dev

Reply via email to