XSD: ways of restricting xml to non-empty tags?

P

Piper707

Hi,

I'd like to know if there are any more ways of restricting an XML
document to having only non-empty tags (containing Strings).

I can think of 2 ways:

1)

<xs:simpleType name="tagName">
<xs:restriction base="xs:string">
<xs:pattern value="([a-zA-Z0-9])+"/>
</xs:restriction>
</xs:simpleType>

2)

<xs:simpleType name="tagName">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>

But approach #2 would allow the user to get away with spaces between
the tags.

Are there any other ways of doing this?

Thanks
Rohit.
 
H

Henry S. Thompson

Piper707 said:
<xs:simpleType name="tagName">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>

But [this] approach would allow the user to get away with spaces between
the tags.

use base="xs:token" instead, which implies aggressive whiteSpace
normalization.

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

Forum statistics

Threads
474,262
Messages
2,571,052
Members
48,769
Latest member
Clifft

Latest Threads

Top