Hi all

i have an xml file and a corresponding xsd.
Everything works fine with old xerces.jar, but now i have to shift to
xerces2 .
when i use xerces2, and try to parse as follows



XMLReader parser = XMLReaderFactory.createXMLReader(saxDriverClass);

DefaultHandler contentHandler = new SAXHandler(doc);
parser.setContentHandler(contentHandler);
parser.setEntityResolver(saxEntityResolver);

parser.setProperty("http://xml.org/sax/properties/lexical-handler";,
      contentHandler);
parser.setFeature("http://xml.org/sax/features/validation";,
                                  validate);
parser.setFeature(
                        "http://apache.org/xml/features/validation/schema";,
                        validate);
parser.setFeature("http://xml.org/sax/features/namespaces";,
                                  true);
parser.setFeature(
                        "http://xml.org/sax/features/namespace-prefixes";,
                        false);

if (saxErrorHandler != null)
{
      parser.setErrorHandler(saxErrorHandler);
}
else
{
      parser.setErrorHandler(contentHandler);
}

parser.parse(in);


It throws an exception

cvc-elt.1: Cannot find the declaration of element 'root'.

what is the possible cause ??

Thanks

Nitin Gupta




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

Reply via email to