Is this complexType declaration valid?

M

mahesh.kanakaraj

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
 
M

Martin Honnen

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top