• 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

Validating with xsd

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using:
javax.xml.validation.* and org.xml.sax.SAXException to validate an xml document against a schema with repeating occurences of a parent key element sucessfully against the total xml document.

I need to link my errors to a parent element.

A simple example would be:

<Data>

<Record>
<KeyField>1</KeyField>
<Information>info about key field 1</Information>
</Record

<Record>
<KeyField>2</KeyField>
<Information>info about key field 2</Information>
</Record

</Data>

What is the most straight forward way to link the error with the <Keyfield> value as the document is being parsed?

Thanks.






What is the most straight forward way to to capture the parent element's child primary key value to tie it in with any errors that are parsed?
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This question probably fits best in the XML forum.

Moving this to the "XML and related technologies" forum.

Henry
 
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
This is off the top of my head but... I have been looking into XML pipeline processing and I think you could handle the problem with a pipeline configuration.
Essentially you would create a SAX event handler sitting between the parser and the Validator which would track the KeyField information as it passes the events through.
This is hard to describe without a lot of handwaving and whiteboard diagrams ;) - fortunately, Elliotte Rusty Harold's chapter on the sort of thing is available online with many examples.
Please let us know what you come up with!
Bill
 
reply
    Bookmark Topic Watch Topic
  • New Topic