Click to See Complete Forum and Search --> : defining undefined in xsd
rorywoodward
03-18-2003, 08:25 AM
My XML has one element which can contain anything:
<jobs>
<payload>
<customStuff>anything</customStuff>
<nestedCustomStuff>
<somethingElse>anything</somethingElse>
</nestedCustomStuff>
</payload>
</jobs>
I want my XSD to say that a "jobs" element can have a child
which is a "payload" element, but that the contents of
the payload are undefined (each job will have a completely different payload). How can I do that?
khalidali63
03-18-2003, 10:07 AM
I am no completely sure if I understood your question completely,
There are XML DTD's which are used to control the contents and flow of elements,look into that
DTD
Khalid
rorywoodward
03-19-2003, 03:54 AM
I'm talking about defining the schema for the XML sample I gave. I want to have a shema which will validate the outer layers of the XML, but will not fail when I put something completely different (and unknown) as children of the payload element.
In other words, I would like a schema which can be used to validate my XML (the example I gave is obviously a snippet) except when it finds an element with the tag "payload".
khalidali63
03-19-2003, 09:21 AM
ok here is what I understood.
you want a dtd that will validate an xml doc that it must have jobs element.
and then the jobs element may or may not have payloads.?
if the above is true then your DTD will look like thsi
<!ELEMENT jobs (payloads?)>
<!ELEMENT payloads (possible,elements,forpayload)>
when imported in XML file the above dtd will validate that there is a jobs element that may or may not have payloads element
Cheers
Khalid
rorywoodward
03-19-2003, 09:28 AM
That's not quite it, but I think I've solved it anyway. I am using a schema, not a DTD. FYI, the following portion from my .xsd file seems to do the trick:
<xs:element name="payload">
<xs:annotation>
<xs:documentation>Freeform XML - only understood by the handler</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:any namespace="##any" processContents="skip" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Thanks for your help.
khalidali63
03-19-2003, 09:36 AM
:D
Well I guess when I used XML (at least couple of yrs ago) XML Schema was only MS based technology...and there was talk of W3C adopting it or not..am not sure.
Cheers
Khalid