My xml editor totally depends on the functionality of the DOMNormalizer In a try to suppress the addition of attributes (see discussion in http://www.nabble.com/Some-consideration-about-the-xerces-DOM-implementation-tf3602407.html) I wrote a DocumentListener that immediately removes the attributes that were added by the normalizer. This way I am getting the exact behavior I want: Error messages for missing required attributes are still reported, but the attributes are not already inserted in the document. But now a very strange behavior was reported. In the editor I am retrieving the typedefinition by casting the attribute to an AttrPSVI. This way I can support the user by displaying combo boxes for enumeration. You can see the behavior in my editor (http://www.donkeydevelopment.com). Put the attached xml and xsd in the same directory. Open the xml document and press the validate button. You will see that the error is reported on the wrong place and that the typeinfo in the combobox is wrong. If you adjust the parameter "insert_default_attributes=false" to "insert_default_attributes=true" in the XMLSpear.properties file, restart the editor and try again you will see the expected behaviour. But this time I do not suppres the insert of the default attribute. Of course I am not absoluty sure but I think it is a bug in xerces. Using Xerces 2.9.0 |
<?xml version="1.0" encoding="UTF-8"?> <ns1:rootElement att3="" xmlns:ns1="http://www.donkeydevelopment.com/schema/example" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.donkeydevelopment.com/schema/example test.xsd"/>
test.xsd
Description: Binary data
Dick Deneer |