Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > [dom4j & Xerces] How to show validation errors?

Reply
Thread Tools

[dom4j & Xerces] How to show validation errors?

 
 
Stefan Siegl
Guest
Posts: n/a
 
      07-17-2003
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",tr ue);

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

 
Reply With Quote
 
 
 
 
Stefan Siegl
Guest
Posts: n/a
 
      07-17-2003
Stefan Siegl wrote:

Sorry, I found the problem. Every time I post my problems here, a few
seconds later I will find it myself.

Please ignore this message

 
Reply With Quote
 
 
 
 
David Zimmerman
Guest
Posts: n/a
 
      07-17-2003


Stefan Siegl wrote:
> Stefan Siegl wrote:
>
> Sorry, I found the problem. Every time I post my problems here, a few
> seconds later I will find it myself.
>
> Please ignore this message
>

Seems to be related to the Murphy's law about lost tools.
The best way to find a lost tool is to buy a new one.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
show calendar show clock tony Cisco 1 09-18-2006 07:13 AM
show all files in the directory, but how to show directory control?? strutsng@gmail.com HTML 1 09-30-2005 07:32 AM
TO show or NOT to show Matt ASP .Net 1 05-02-2005 09:07 PM
to show image or to show flash Disco Octopus HTML 7 05-14-2004 06:27 AM
Command "show run" does not show all interfaces Peter Jonas Cisco 3 01-05-2004 12:13 AM



Advertisments