• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Displaying an user-friendly message while validating xml with dtd

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have to validate a set of XML files against their DTD and print user-friendly error messages if validation fails.

I tried using popular parsers such as Xerces and the error message displayed is of the form:

Which unfortunately does not tell the user what is the offending element. I need to print something similar to error messages displayed on commercial tools like XMLSpy like:


The Apache Crimson Parser which was part of JDK 1.4 distribution prints messages pointing to the cause of error. However this parser is not used anymore (is obsolete?)
and JDK1.5 uses Xerces as the default parser. Hence I am not very confident on using Crimson.

Is there any other parser that would satisfy my requirement?

Thanks in advance for your help,
Vijay
 
Vijay Chouhan
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Will appreciate any comments? Is there any other way out without depending on the Parser? I hope what I am saying makes sense..

TIA
Vijay
 
Sheriff
Posts: 28417
102
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't tell the parser what error messages to use. So clearly if you want the error messages that a particular parser issues, you must use that parser.

You don't have to use the parser that's built into your version of Java. You can use a different parser if you like. (I don't recall the procedure for doing that but I'm sure it's documented somewhere.)
 
reply
    Bookmark Topic Watch Topic
  • New Topic