Hello everyone,

i've a problem with the result of the validation. I validate my xml file
against a xsd and everything is working fine, except that i can't get the
name of the element that was not correctly filled. That means if i've an
empty element "id" in my xml, which is from type integer, the error message
i got is 

cvc-datatype-valid.1.2.1: '' is not a valid value for 'integer'.

which is correct, but i would like to print out the name of the element with
the invalid value.

All information my errorhandler gives me are

publicId: null
systemId: null
line number: 33
column number: 22
localized message: cvc-datatype-valid.1.2.1: '' is not a valid value for
'integer'.
message: cvc-datatype-valid.1.2.1: '' is not a valid value for 'integer'.
toString(): org.xml.sax.SAXParseException: cvc-datatype-valid.1.2.1: '' is
not a valid value for 'integer'.

<code>
public class MyErrorHandler implements ErrorHandler {

        public void error(SAXParseException arg0) throws SAXException {
                System.out.println("publicId: " + arg0.getPublicId());
                System.out.println("systemId: " + arg0.getSystemId());
                System.out.println("line number: " + arg0.getLineNumber());
                System.out.println("column number: " + arg0.getColumnNumber());
                System.out.println("localized message: " + 
arg0.getLocalizedMessage());
                System.out.println("message: " + arg0.getMessage());
                System.out.println("toString(): " + arg0.toString());
                System.out.print("Parsing XML failed due to a:\n" +
arg0.getClass().getName());
                throw arg0;

        }

        public void fatalError(SAXParseException arg0) throws SAXException {
                System.out.println("publicId: " + arg0.getPublicId());
                System.out.println("systemId: " + arg0.getSystemId());
                System.out.println("line number: " + arg0.getLineNumber());
                System.out.println("column number: " + arg0.getColumnNumber());
                System.out.println("localized message: " + 
arg0.getLocalizedMessage());
                System.out.println("message: " + arg0.getMessage());
                throw arg0;

        }

        public void warning(SAXParseException arg0) throws SAXException {
                System.out.println("publicId: " + arg0.getPublicId());
                System.out.println("systemId: " + arg0.getSystemId());
                System.out.println("line number: " + arg0.getLineNumber());
                System.out.println("column number: " + arg0.getColumnNumber());
                System.out.println("localized message: " + 
arg0.getLocalizedMessage());
                System.out.println("message: " + arg0.getMessage());
                throw arg0;

        }

}
</code>

The element definition in the xsd is 

    <xs:element name="ID" type="ID" />

    <xs:simpleType name="ID">
        <xs:restriction base="xs:integer">
            <xs:totalDigits value="7" />
        </xs:restriction>
    </xs:simpleType>

Has somebody an idea how i can solve my problem?

Thanking you in advance for any help you can give me.

-- 
View this message in context: 
http://old.nabble.com/missing-element-name-in-validation-result-tp29489740p29489740.html
Sent from the Xerces - J - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to