Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > A beginners question about substitution groups

Thread Tools

A beginners question about substitution groups

Posts: n/a

I'm currently teaching myself about XML schems at the same time as
specifying the XML document for a project I've been given to write.
(I'm new to the XML world, so progress is a little slow at the moment!)

I find myself needing to restrict an element to contain either an
integer in the range of 01 - 99 OR the value "*9". Because of the
asterisk an simple integer field is not sufficient so I suspect I need
to use a substitution group to specify that this element can either be
an integer, or a string with only one permissable value.

I'm following the XML Schema Part 0 - 3 from the website to
indicate what is permissible in the language.

I'm a little confused about how to code up a substitution group so that
the value is either a ranged integer, or a specific string. Could
someone point me in the direction of some other documentation which is
a little more readable than the official primer, or describe to me how
it's done - I don't want some canned XML with "This will do what you
require", as I'd like to work this simple problem through myself.


Reply With Quote
Priscilla Walmsley
Posts: n/a

You actually need a union type rather than a substitution group. The
Primer has some coverage on that:

There is an example of a union type from my book (and many more schema
examples) at:

Hope that helps,

Priscilla Walmsley
Author, Definitive XML Schema
Definitive XQuery

*** Sent via Developersdex ***
Reply With Quote
Posts: n/a
Aha! A union (which I'd not actually read about yet) is definitely the
way to go. I think that I may do well with a comfortable book, rather
than the precise, but slightly terse, standards docs!

Seeing as you've written both, it I feel I should look no further!

Many thanks Priscilla - my schema is rolling again...


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[OT] Posting to perl.beginners via google groups sisyphus Perl Misc 16 04-30-2009 07:14 PM
XML Schema EDC, UPA and substitution groups Soren Kuula XML 2 02-03-2006 04:20 AM
Xml Schema substitution groups / key keyref John Carron XML 2 09-02-2005 06:22 PM
Xml Schema substitution groups / key and keyref John Carron XML 0 09-01-2005 06:52 PM
Windows groups, VPN groups, and SecureACS John Sasso Cisco 0 10-02-2004 03:39 PM