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.
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.