• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Please Help

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We are facing a problem ...
We are parsing Request xmls using Xerces Parser. Now we are validating the same with Schemas. During parsing if there are any errors due to Missing or Invalid Elements we need to show the Tags to the user.
I am using the ErrorHandler Interface, in the error() I am unable to extract the Element Name from SAXParseException.
Please help me in finding a solution to find the same by JAXP or Xerces APIs.
Any help will be extremeley appreciated.
Thanks in advance
Shrinath
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm moving this post to the XML forum, which is intended for this kind of questions (this forum is about XML certification.
Please continue the discussion over there.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are using a SAX parser you could keep track of the most recent startElement and/or endElement calls.
In addition to the getLineNumber() and getColumnNumber() methods,
SAXParseException has the getPublicId() and getSystemId() methods.
They should give you some clue as to which element has the error.
Bill
 
s rao
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you William for your reply.
The main problem we are facing today is about Missing Tags. If any one of the tag is missing then startElement() is not helpful as the tag itself is no present in the request. And the error message in SAXParseException shows the next tag in the request as error.
Please let me know the usage of SystemId and PublicId to extract tag name. I am not very clear on its usage.
Thanks in Advance
Shrinath
 
reply
    Bookmark Topic Watch Topic
  • New Topic