Hi,
My request message is :
<?xml version="1.0" encoding="utf-8"?>
11
20
and my xsd schema to validate the request message against are as follows:
REQUEST.XSD
<?xml version="1.0" encoding="utf-8"?>
REQUEST_APP1.XSD
<?xml version="1.0" standalone="yes"?>
REQUEST_APP2.XSD
<?xml version="1.0" standalone="yes"?>
My validation code is:
public void validateRequest(ByteArrayInputStream isReqMsg) throws SAXException, IOException
{
SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
File schemaLocation = new File("request.xsd");
try {
Schema schema = factory.newSchema(schemaLocation);
Validator validator = schema.newValidator();
validator.validate(new StreamSource(isReqMsg));
System.out.println("Request message is valid.");
}
catch (SAXException ex) {
System.out.println("Request message is invalid because ");
System.out.println(ex.getMessage());
System.out.println(ex.getStackTrace());
throw ex;
}
catch(IOException ie)
{
System.out.println("Cannot read message because ");
System.out.println(ie.getMessage());
throw ie;
}
}
The validator gives me the following error:
org.xml.sax.SAXParseException: cvc-datatype-valid.1.2.1: '#id0' is not a valid value for 'integer'.
Can anybody help spot the error?
Thanks!!
Karan