469,573 Members | 1,630 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,573 developers. It's quick & easy.

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

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.

Dec 21 '05 #1
1 1965
Piper707 writes:
<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: ht@inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
Dec 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Shock | last post: by
3 posts views Thread by Matthet | last post: by
1 post views Thread by Roland | last post: by
1 post views Thread by Brett Gerhardi | last post: by
2 posts views Thread by Martijn | last post: by
2 posts views Thread by yaya9 | last post: by
3 posts views Thread by Pascal Brunot | last post: by
1 post views Thread by Clodo | last post: by
reply views Thread by liuhengyi | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.