Hi Dave
----- Original
Message -----
Sent: Saturday, April 06, 2002 6:56
PM
Subject: [dom4j-dev] XSL and null
attributes
I have found that if you use the
statement
testElement.addAttribute("test", null);
Saxon will throw a NullPointer exception if you
use this attribute in an expression that tests equality, such
as "@test='1' ".
Is there any advantage or reason for allowing
null attribute values in dom4j? When the xml is serialized null and
empty string appear identical @test=""
I believe Xerces handles this by converting the
null to an empty string on insertion. I
did test it with Xalan, and Xalan treats the null as an empty string and
processes without an Exception. Would it be possible to change this
behavior in dom4j to play nice with Saxon? Or does the XML spec say that
DOM attributes can have a null state, and this is a Saxon bug to
fix?
I guess strictly speaking an attribute
should never be null so dom4j should probably throw a NullPointerException if
you were to try add a new attribute with a null String value.
Incidentally are you using the
DocumentSource to play with Saxon? If so we could just hide any null valued
attributes from XSLT engines, it'd be an easy fix.
Also, I'm curious what the ETA on:
dom4j will soon provide a configuration option to support the W3C
DOM API natively to avoid unnecessary tree duplication when using dom4j
with XSLT engines etc.
The early work has been done, its in the org.dom4j.dom package.
Though more work is required to get it to pass the W3C DOM compliance tests.
James
|