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
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
The results don’t disappoint.
I made a
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.
Interesting. Actually, this will be quite helpful for the feed parser I’m writing since it uses REXML.
I think you’re missing a few test cases. How does this interact with HTTP? If no xml:base is specified on the root element, the base URI is the base URI of the document. The base URI of the document could be the document URI, or it could be specified in a Content-Location HTTP header (or Content-Base, but let’s ignore that for now). The Content-Location header can itself be a relative URI, in which case it is relative to the URI of the document.
Mark, unquestionably, this meager set of tests is just a starter set. However, two of the four tests do rely on an XML base being externally provided as the href and all the xml:base elements are relative. I even factored out the externally provided base as a parameter to the parse routine (with a default provided for the purposes of testing).
Actually interacting with HTTP will have to wait until I create a rails version. From what I have read, rail’s support for testing goes far beyond what I have explored here. Particularly, when you get to the chapter on testing controllers.
Den här veckans intressanta länkar, från del.icio.us/staffanmalmgren Using the Rake Build Language [make programming rake ruby toread] –"Rake is a build language, similar in purpose to make and ant. Like make and ant...
Seth Gordon: That would certainly cover the front page, but that’s about it. Fortunately, there are bits and pieces that cover the rest. I’ve contributed heavily to Planet, the Universal Feed Parser,...