How to specify free xml using a schema?

Discussion in 'XML' started by M?ht?n, May 5, 2004.

  1. M?ht?n

    M?ht?n Guest

    Hi all,

    I've got an XML file that I'm using for communication via SOAP.
    Now the XML format contains several mandatory fields, but I also need
    the possibility to pass random XML in one specific field. E.g.:

    <package>
    <origin>
    <name>Martijn</name>
    <country>NL</country>
    </origin>
    <data>
    <id>QLF00256943</id>
    <description>...</description>
    <customXML>
    <rubbish>fl..t</rubbish>
    </customXML>
    </data>
    </package>

    All these fields have been defined in the XSD. However, I don't want
    the <customXML> element's contents to be checked (except for valid XML
    formatting).

    How can I do that?

    Thanks,
    Martijn
     
    M?ht?n, May 5, 2004
    #1
    1. Advertising

  2. M?ht?n wrote:


    > I've got an XML file that I'm using for communication via SOAP.
    > Now the XML format contains several mandatory fields, but I also need
    > the possibility to pass random XML in one specific field. E.g.:
    >
    > <package>
    > <origin>
    > <name>Martijn</name>
    > <country>NL</country>
    > </origin>
    > <data>
    > <id>QLF00256943</id>
    > <description>...</description>
    > <customXML>
    > <rubbish>fl..t</rubbish>
    > </customXML>
    > </data>
    > </package>
    >
    > All these fields have been defined in the XSD. However, I don't want
    > the <customXML> element's contents to be checked (except for valid XML
    > formatting).
    >


    In your schema use
    <xs:element name="customXML">
    <xs:complexType>
    <xs:sequence>
    <xs:any processContents="skip" minOccurs="1"
    maxOccurs="unbounded" />
    </xs:sequence>
    </xs:complexType>
    </xs:element>

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, May 5, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page