Re: XML Schema: unknown sub-element

Discussion in 'XML' started by Florian Deissenboeck, Nov 18, 2003.

  1. "Thomas Jollans" <> schrieb im Newsbeitrag
    news:bparut$op0$02$-online.com...
    > I would like to have something like this:
    >
    > <a:element1 xmlns:a="...">
    > <a:element2>
    > <b:element1 xmlns:b="...">
    > <b:element2/>
    > </b:element1>
    > </a:element2>
    > </a:element1>
    >
    > where the schema of a:... doesn't know anything about schema b:..., but
    > knows where there will be (unknown) non-a:... elements. is this possible
    > with XML Schema?


    Possible!

    <xs:element name="element2">
    <xs:complexType>
    <xs:sequence>
    <xs:any namespace="xyz"
    processContents="skip"
    maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>

    This allows <element2> of the target namespace to include all elements of
    namespace 'xyz'.

    Flo
     
    Florian Deissenboeck, Nov 18, 2003
    #1
    1. Advertising

  2. Florian Deissenboeck wrote:
    > "Thomas Jollans" <> schrieb im Newsbeitrag
    > news:bparut$op0$02$-online.com...
    >
    >>I would like to have something like this:
    >>
    >><a:element1 xmlns:a="...">
    >> <a:element2>
    >> <b:element1 xmlns:b="...">
    >> <b:element2/>
    >> </b:element1>
    >> </a:element2>
    >></a:element1>
    >>
    >>where the schema of a:... doesn't know anything about schema b:..., but
    >>knows where there will be (unknown) non-a:... elements. is this possible
    >>with XML Schema?

    >
    >
    > Possible!
    >
    > <xs:element name="element2">
    > <xs:complexType>
    > <xs:sequence>
    > <xs:any namespace="xyz"
    > processContents="skip"
    > maxOccurs="unbounded"/>
    > </xs:sequence>
    > </xs:complexType>
    > </xs:element>
    >
    > This allows <element2> of the target namespace to include all elements of
    > namespace 'xyz'.
    >
    > Flo


    So, as far as I can see from http://www.w3.org/TR/xmlschema-1, if I omit
    the namespace attribute, I can use any namespace. but what does the
    processContent attribute do?

    Thomas
     
    Thomas Jollans, Nov 18, 2003
    #2
    1. Advertising

  3. > > <xs:element name="element2">
    > > <xs:complexType>
    > > <xs:sequence>
    > > <xs:any namespace="xyz"
    > > processContents="skip"
    > > maxOccurs="unbounded"/>
    > > </xs:sequence>
    > > </xs:complexType>
    > > </xs:element>
    > >
    > > This allows <element2> of the target namespace to include all elements

    of
    > > namespace 'xyz'.
    > >
    > > Flo

    >
    > So, as far as I can see from http://www.w3.org/TR/xmlschema-1, if I omit
    > the namespace attribute, I can use any namespace. but what does the
    > processContent attribute do?
    >

    I consider omitting the namespace attribute not very elegant. By doing so
    you simply allow everything at this point, this allows structure which
    aren't allowed in other places of your document. For the
    processContents-Attribute see the following Quote.

    Flo

    Quoting from "XML Schema" by Eric van der Vlist (O'Reilly): "processContents
    specifies the behavior of the validator regarding the elements or attributes
    from the specified namespace. The possible values are 'skip' (no validation
    is attempted on these elements or attributes), 'strict' (schemas for the
    namespace that will be included need to be available, and validators will
    validate the elements and attributes against these schemas), or 'lax'
    (validators will do their best to find a schema for the included elements
    and attributes, validate them when they have found one, and silently skip
    the validation when they haven't."
     
    Florian Deissenboeck, Nov 22, 2003
    #3
    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.
Similar Threads
  1. Markus
    Replies:
    1
    Views:
    1,623
    Markus
    Nov 23, 2005
  2. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,301
    Stanimir Stamenkov
    Apr 25, 2005
  3. Eric
    Replies:
    4
    Views:
    1,126
    Stan Kitsis [MSFT]
    Mar 7, 2007
  4. Ben
    Replies:
    2
    Views:
    930
  5. Lawrence D'Oliveiro

    Death To Sub-Sub-Sub-Directories!

    Lawrence D'Oliveiro, May 5, 2011, in forum: Java
    Replies:
    92
    Views:
    2,101
    Lawrence D'Oliveiro
    May 20, 2011
Loading...

Share This Page