Hi,
How do you specify the name and location of the Schema file .xsd against
which the validate() method will validate the XML file ?
In the following example, where/how do you specify the name / location
of the schema .xsd file ?
// Create an XmlOptions instance and set the error listener.
XmlOptions validateOptions = new XmlOptions();
ArrayList errorList = new ArrayList();
validateOptions.setErrorListener(errorList);
// Validate the XML.
boolean isValid = newEmp.validate(validateOptions);
// If the XML isn't valid, loop through the listener's contents,
// printing contained messages.
if (!isValid)
{
for (int i = 0; i < errorList.size(); i++)
{
XmlError error = (XmlError)errorList.get(i);
System.out.println("\n");
System.out.println("Message: " + error.getMessage() + "\n");
System.out.println("Location of invalid XML: " +
error.getCursorLocation().xmlText() + "\n");
}
}
Thanks
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]