472,144 Members | 1,935 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,144 software developers and data experts.

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 2061
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 Saiars | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.