Hi Nitin , A quick answer is to set the following feature to true. http://apache.org/xml/features/validation/dynamic
let us know.
-venu
[EMAIL PROTECTED] wrote:
hi all there has been a mail with the same subject some months ago. it was regarding DOM. I am facing the same problem with XMLReader. There is a file rtrv_dgn_status.xml and two xsds Dialog.xsd, DialogTypes.xsd. Following is the method in which parse is called.
protected void build(InputSource in) throws JDOMException {
Document doc = new Document(); try { XMLReader parser = XMLReaderFactory.createXMLReader(saxDriverClass);
if (saxXMLFilter != null) {
// Connect filter chain to parser XMLFilter root = saxXMLFilter;
while (root.getParent() instanceof XMLFilter) { root = (XMLFilter)root.getParent(); }
root.setParent(parser);
// Read from filter parser = saxXMLFilter; }
DefaultHandler contentHandler = new SAXHandler(doc); parser.setContentHandler(contentHandler);
if (saxEntityResolver != null) { parser.setEntityResolver(saxEntityResolver); }
if (saxDTDHandler != null) { parser.setDTDHandler(saxDTDHandler); }
parser.setProperty(
"http://xml.org/sax/properties/lexical-handler", contentHandler); lexicalReporting = true;
// Set validation try {
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); } } catch (SAXNotSupportedException e) { } catch (SAXNotRecognizedException e) { } parser.parse(in); System.out.println("parsed successfully"); } catch (Exception e) { }
Attached are the corresponding xml and xsd files
Thanks and Regards
Nitin Gupta
(See attached file: DialogTypes.xsd)(See attached file: Dialog.xsd)(See attached file: rtrv_dgn_status.xml)
------------------------------------------------------------------------
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
