[Home] [By Thread] [By Date] [Recent Entries]

  • From: John Cowan <cowan@m...>
  • To: Mukul Gandhi <gandhi.mukul@g...>
  • Date: Sun, 26 Feb 2012 15:25:44 -0500

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

[snip]

> 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@c...
      That thou wast born with.


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


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member