XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
  #1  
Old June 26th, 2003, 02:41 AM
Nilesh002 Nilesh002 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 1 Nilesh002 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How to extract some meaningful information from a SAXParseException?

I am using Xerces 2.4.0 to validate my xml documents.
The code is the usual parser stuff like
-----------
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
dbf.setAttribute(.....) etc etc.
----------

My schema has a lot of rules with many restrictions on several nodes.

Whenever I give an invalid xml file (non conforming to my schema) to the parser, it throws SAXParseException.
These exceptions are logged in my logs.

For example,
org.xml.sax.SAXParseException: cvc-minInclusive-valid: Value '-240' is not facet-valid with respect to minInclusive '1'.
org.xml.sax.SAXParseException: cvc-minInclusive-valid: Value '-400' is not facet-valid with respect to minInclusive '1'.
org.xml.sax.SAXParseException: cvc-maxInclusive-valid: Value '40000000' is not facet-valid with respect to maxInclusive '1500'.


As you can see the error messages are not much useful. I want to get the name of the node in the xml file which caused
the problem. If I can get the name of the node/element in the xml file, I will be able to display more meaningful
error messages to the user such as:

"The value entered for cost is invalid: -240". etc.

Is there any way I can extract more information out of the SAXParseException,
so that I can get the node's name and/or value?


Thanks in advance.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > How to extract some meaningful information from a SAXParseException?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway