S
Stefan Siegl
Hello
I am using the dom4j API which will use the Xerces2 SAX Parser. I set
this Parser to use validation. The problem I face is, that I need to
know what exactly went wrong during the check for well-formedness resp.
the validation check.
If _anything_ went wrong, meaning either a well-formed error or a
validation error, a DocumentException is thrown, containing no
inforamtion about what went wrong.
In my application (in fact it is a servlet) I will receive xml files. If
they are not valid I have to return the information what went wrong.
Do you know of any possiblity?
Here is my code so far:
public Document buildDocument () throws DocumentException,
SAXException{
Document doc = null;
SAXReader reader = new
SAXReader("org.apache.xerces.parsers.SAXParser",true);
reader.setFeature("http://xml.org/sax/features/namespaces",true);
reader.setFeature("http://xml.org/sax/features/validation",true);
reader.setFeature("http://apache.org/xml/features/validation/schema",true);
DocumentFactory factory = reader.getDocumentFactory();
doc = reader.read(stream);
return doc;
}
Thanks in advance,
Stefan Siegl
I am using the dom4j API which will use the Xerces2 SAX Parser. I set
this Parser to use validation. The problem I face is, that I need to
know what exactly went wrong during the check for well-formedness resp.
the validation check.
If _anything_ went wrong, meaning either a well-formed error or a
validation error, a DocumentException is thrown, containing no
inforamtion about what went wrong.
In my application (in fact it is a servlet) I will receive xml files. If
they are not valid I have to return the information what went wrong.
Do you know of any possiblity?
Here is my code so far:
public Document buildDocument () throws DocumentException,
SAXException{
Document doc = null;
SAXReader reader = new
SAXReader("org.apache.xerces.parsers.SAXParser",true);
reader.setFeature("http://xml.org/sax/features/namespaces",true);
reader.setFeature("http://xml.org/sax/features/validation",true);
reader.setFeature("http://apache.org/xml/features/validation/schema",true);
DocumentFactory factory = reader.getDocumentFactory();
doc = reader.read(stream);
return doc;
}
Thanks in advance,
Stefan Siegl