XML Schema question

L

Luigi

Hi all!

I received an XML Schema in order to create some documents, but inside
it there is a definition that looks mistaken:

<!-- INFO is a name-value pair -->
<xs:element name="INFO">
<xs:complexType mixed="true">
<xs:complexContent>
<xs:extension base="xs:string">
<xs:attribute name="ID" type="xs:ID"/>
<xs:attribute name="name" type="xs:token" use="required"/>
<xs:attribute name="value" type="xs:string" use="required"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>

Do you agree?

If like this, what's you opinion on the right definition?

Thank you!

Luigi
 
L

Luigi

This was the right declaration:

<!-- INFO is a name-value pair -->
<xs:element name="INFO">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="ID" type="xs:ID"/>
<xs:attribute name="name" type="xs:token" use="required"/>
<xs:attribute name="value" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
 
H

Henry S. Thompson

Luigi said:
This was the right declaration:

<!-- INFO is a name-value pair -->
<xs:element name="INFO">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="ID" type="xs:ID"/>
<xs:attribute name="name" type="xs:token" use="required"/>
<xs:attribute name="value" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>

Well, that's the 'right' declaration if you want to allow only text as
the content of <INFO>. If you want to allow arbitrary mixed content,
what you want is

<!-- INFO is a name-value pair -->
<xs:element name="INFO">
<xs:complexType mixed="true">
<xs:sequence>
<xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="ID" type="xs:ID"/>
<xs:attribute name="name" type="xs:token" use="required"/>
<xs:attribute name="value" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>

ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: (e-mail address removed)
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
 

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,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top