Thomas,
thanks to the second error I just reported,
I could pinpoint the source of the problem and, hopefully,
create fix.
The problem resulted from dom4j.Attribute returning the empty string as
namespace URI if none is set, where as Batik expects a value of 'null'
in such a case.
Unfortunately, it appears to me that the dom4j version is correct in
this case.
There is some ambiguity in RFC 2396
(http://www.rfc-editor.org/rfc/rfc2396.txt), but I the way I read it,
there is at least one component (the 'path') of an URI (and hence, an
IRI and a namespace declaration), that may not be undefined.
I believe the relevant sections to be "3.3. Path Component" and "5.2.
Resolving Relative References to Absolute Form", the latter of which
states that, quote,
"If the path component is empty and the scheme, authority, and query
components are undefined, then it is a reference to the current document
and we are done.",
unquote.
If my interpretation is correct, the empty namespace should be
represented by the empty string instead of 'null'.
(Personally, I think this makes it unnecessary hard on the programmer
wishing to work with the specification. But that's another matter entirely.)
Thus, I've decided to modify the Batik classes by adding
if (namespaceURI=="") {
namespaceURI=null;
}
to the setAttributeNS method (~line 230) of the AbstractElement class,
of which all relevant Elements for an SVG document seem to be derived.
All other changes I proposed can be discarded.
This solution works for me, but please let me know if there is any
problem with it (or if the assumption above is wrong) so I can patch
dom4j instead.
Good night
-Urs
=================================
The changed method now reads:
public void setAttributeNS(String namespaceURI,
String qualifiedName,
String value) throws DOMException {
if (attributes == null) {
attributes = createAttributes();
}
if (namespaceURI=="") {
namespaceURI=null;
}
Attr attr = getAttributeNodeNS(namespaceURI, qualifiedName);
if (attr == null) {
attr = getOwnerDocument().createAttributeNS(namespaceURI,
qualifiedName);
attr.setValue(value);
attributes.setNamedItemNS(attr);
} else {
attr.setValue(value);
}
}
===============================
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]