[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: What does "optional" mean?

  • From: John Cowan <cowan@mercury.ccil.org>
  • To: Mukul Gandhi <gandhi.mukul@gmail.com>
  • Date: Sun, 26 Feb 2012 15:25:44 -0500

Re:  What does "optional" mean?
Mukul Gandhi scripsit:

> Following is an use case, that probably makes the notion of "optional"
> in XML documents *necessary*,
> Let's assume, that a book object may be represented in an XML format


> i.e, an ISBN number of book may be represented either as an attribute
> or as a child element of element book, but not at both of these
> places. To define a schema for this need (at least with XSD I
> believe), a schema author I think *must* make the attribute "isbn" and
> the element "isbn" as optional and constrain a singular cardinality of
> the semantic information "isbn" via another schema constraint.

That is indeed an XSD 1.0 limitation.  It does not apply to RNG, where
representing a choice between an element and an attribute is trivial.
I don't know if it applies to XSD 1.1 or not.  It does not apply to
Schematron either, where everything that is not forbidden is permitted.

There is a more general point: it's not always possible in any schema
language to represent the exact specification, and applications may need
to do further validation of the input.

LEAR: Dost thou call me fool, boy?      John Cowan
FOOL: All thy other titles              http://www.ccil.org/~cowan
             thou hast given away:      cowan@ccil.org
      That thou wast born with.

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.