Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using only part of an XSD

Status
Not open for further replies.

chiph

Programmer
Jun 9, 1999
9,878
US
What I'm trying to do is validate the "payload" part of an XML document using a XSD that controls the contents of the entire document.

The XSD contains:
- Credentials section
- A "data" section that is the actual specification of the document contents that can recur 0..many times.

The XML file as a whole conforms to the XSD, but when I read the (very large) file via SAX, all I have is one of the "data" sections. I load this section into a DOM, and then try & validate it against the XSD. It fails because it's missing the Credentials stuff.

The obvious answer would be to attach the schema to the SAX parser, and I used to have it that way, but QA doesn't want the entire parsing process to stop for a schema violation (they just want to fail that one record).

Another way to make this happen is to have two XSDs - one for public consumption that has the credentials & all, and another for internal use that just has the payload portion. The problem with this is keeping the two in sync, and I'm not thrilled over that.

So, is there some way to tell the DOM to validate it's contents against the schema, starting at a certain element?

Thanks in advance
Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top