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?
 
 
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.

Dave

Reply via email to