Hi,

I'm using Java 5 with xerces beta dom3 2.6.2
implementation.

My problem is the following :

When I try to normalize a Document that I've created
in my code I've received the following error :

NullLocalElementName: A null local name was
encountered during namespace normalization of element
item.

My code :

try
                {
                
System.setProperty(DOMImplementationRegistry.PROPERTY,"org.apache.xerces.dom.DOMImplementationSourceImpl");
                        DOMImplementationRegistry registry =
DOMImplementationRegistry.newInstance();
                        DOMImplementation impl =
(DOMImplementation)registry.getDOMImplementation("XML
3.0");
        Document doc =
impl.createDocument(null,"simple",null);
                        
        Element item = doc.createElement("item");
                        item.appendChild(doc.createTextNode("plip"));
                        
                        doc.getDocumentElement().appendChild(item);
                        
        DOMConfiguration config = doc.getDomConfig();
                        config.setParameter("validate",Boolean.TRUE);
                        config.setParameter("error-handler",new
DOMErrorHandler() {
                        
        public boolean handleError(DOMError error) {    
System.out.println(error.getMessage());
                        return false;
                }                       
        });
                
config.setParameter("schema-type","http://www.w3.org/2001/XMLSchema";);
                
config.setParameter("schema-location","simple.xsd");
                        
        doc.normalizeDocument();
                        
        OutputFormat format = new OutputFormat(doc);
        format.setIndenting(true);
        XMLSerializer serial = new
XMLSerializer(System.out,format);
        serial.asDOMSerializer();
        serial.serialize(doc);
                        
}
catch (ClassCastException e)
{
        e.printStackTrace();
}

The corresponding schema :

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>

<xs:element name="simple" type="simpleType"/>

<xs:complexType name="simpleType">
        <xs:sequence>
                <xs:element name="item" type="xs:string"/>
        </xs:sequence>
</xs:complexType>

</schema>

The interesting thing is that when I parse a valid XML
file with DOMImplementationLS and I normalize it
after, it's working fine without any error message.

Maybe it's a problem of parameters in the
DOMConfiguration.

Any ideas?



        

        
                
__________________________________________________________________ 
D�couvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails ! 
Cr�ez votre Yahoo! Mail sur http://fr.mail.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to