xml schema and using a choice as the document root
Posted
by mikey
on Stack Overflow
See other posts from Stack Overflow
or by mikey
Published on 2009-10-28T18:38:43Z
Indexed on
2010/03/29
14:43 UTC
Read the original article
Hit count: 659
I have a bit of a newbie xml schema question. I believe the answer is that what I need to do is not possible with schema, but I'd like to be sure. The problem is that I have a webservice that returns a response with one type of root element on success (say <Response>), and on a complete failure, returns a document with a different root element (say, <Exception>). So, basically, two completely different documents:
<Response>......</Response> OR
<Exception>....</Exception>
Is it possible to describe these two different documents with one schema document? It's like I want a choice as the first element under the schema element -- but that isn't valid syntax. I've tried a couple of variants that parse as valid xsd, but don't validate the documents. Any suggestions? Or is this simply not possible? Thanks very much in advance -- m
© Stack Overflow or respective owner