Whitespace control using schemas

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Oli Filth

    Whitespace control using schemas

    Hello

    I'm fairly new to XML, and currently working on an XSD schema. I'm
    having a problem when validating against it, specifically when it comes
    to using xs:token.

    If a "details" element is declared as:

    <element name="details" type="xs:token" maxOccurs="unbo unded" />

    then is the 2nd line of the following XML markup valid?

    <details>Some text</details>
    <details> Some text </details>

    From reading various things on the net, I was of the understanding that
    the 2nd line *should* be valid (i.e. the implied whiteSpace="col lapse"
    facet is only relevant when the XML is processed by an application).
    However, the validator at
    http://apps.gotdotnet.com/xmltools/xsdvalidator/ disagrees with me, saying:

    "the 'details' element has an invalid value according to its data type."

    Is this correct?


    --
    Oli
  • Priscilla Walmsley

    #2
    Re: Whitespace control using schemas

    Hi Oli,

    You are correct; it should be valid. Unlike the other facets, the
    whiteSpace facet is not so much a constraint on what's allowed in an XML
    document. It is more of an instruction to the processor on how to
    handle whitespace.


    Hope that helps,
    Priscilla

    ----------------------------------
    Priscilla Walmsley
    Author, Definitive XML Schema

    ----------------------------------

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!

    Comment

    Working...