Whitespace control using schemas

O

Oli Filth

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="unbounded" />

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="collapse"
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?
 
P

Priscilla Walmsley

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,244
Members
46,838
Latest member
KandiceChi

Latest Threads

Top