Is this complexType declaration valid?

Discussion in 'XML' started by mahesh.kanakaraj@gmail.com, Jul 10, 2007.

  1. Guest

    Dear All,

    I have a question to ask about the validity of a complexType
    declaration.

    Lets say an element declaration inside a schema looks like this....

    <element name="abc" type="abcType">

    and type declaration looks like,

    <complexType name="abcType">
    <attribute name="abcAttr" type="string">
    </complexType>

    Is the above mentioned valid? The question really came up when I
    was trying to figure out what would be content of the element
    'abc' in the instance and how would I verify/validate it.

    Thanks in Advance,
    Mahesh Kanakaraj
    , Jul 10, 2007
    #1
    1. Advertising

  2. wrote:

    > Lets say an element declaration inside a schema looks like this....
    >
    > <element name="abc" type="abcType">
    >
    > and type declaration looks like,
    >
    > <complexType name="abcType">
    > <attribute name="abcAttr" type="string">
    > </complexType>
    >
    > Is the above mentioned valid? The question really came up when I
    > was trying to figure out what would be content of the element
    > 'abc' in the instance and how would I verify/validate it.


    With that definition the element needs to be empty. What you have
    defined is a shortcut for
    <xs:complexType>
    <xs:complexContent>
    <xs:restriction base="xs:anyType">
    <xs:attribute name="abcAttr" type="xs:string"/>
    </xs:restriction>
    </xs:complexContent>
    </xs:complexType>
    See <http://www.w3.org/TR/xmlschema-0/#emptyContent> for more explanation.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Jul 10, 2007
    #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.
Similar Threads
  1. Moth
    Replies:
    2
    Views:
    421
  2. Wolfgang
    Replies:
    2
    Views:
    732
    Wolfgang
    Oct 7, 2003
  3. D. Alvarado

    complexType is not allowed here!?

    D. Alvarado, Apr 20, 2004, in forum: XML
    Replies:
    2
    Views:
    845
    Henry S. Thompson
    Apr 21, 2004
  4. tsolbjor
    Replies:
    0
    Views:
    491
    tsolbjor
    Jul 19, 2004
  5. unishippers.suckfeed.newshosting.com

    XSD Schema: complexType or Group?

    unishippers.suckfeed.newshosting.com, Nov 4, 2004, in forum: XML
    Replies:
    2
    Views:
    398
    unishippers.suckfeed.newshosting.com
    Nov 5, 2004
Loading...

Share This Page