xml:base support
The version of REXML included within ruby 1.8.2 does not appear to contain xml:base support. However, this is not much of a problem in Ruby, as such support can easily be added.
This
code checks for the method named defined by
DOM3, and if not found, adds it directly to the
REXML::Element class. I also include four unit
tests, ones that focus more on different combinations of
xml:base usage than on the correct operation of
URI.join.
While the tests passed, as I wrote both the code and the tests, this begs the question as to whether or not I have interpreted the spec correctly. As libxml2 has a reputation for speed, completeness, and correctness, and has a Python interface, I simply ported the test. The results don’t disappoint.
I made a
similar
attempt with JDK 5.0, but with
less positive results. Apparently in one of the tests,
getBaseURI returns null. If anybody
has any insight into either the problem or in what I did
incorrectly, I would appreciate it.