XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Doug HubbardSubject: XSD Validation
Author: Doug Hubbard
Date: 27 Jul 2006 01:56 PM
I am having an issue in that XML I am generating validates against the XSD fine in Stylus studio and in a custom C# app I have written, but when developers at our parent company use XML Spy (I didn't pick it, but am stuck with them using it) The docs fail to validate due to whitespace in numeric fields.

As an example I have a node in my Schema named PAR_TIME
<xs:element name="PAR_TIME" type="xs:decimal"/>
If the node is <PAR_TIME>51.98 </PAR_TIME> XML Spy fails (but Stylus does not) yet if the node is <PAR_TIME>51.98</PAR_TIME> both work.

I have a couple of questions about this
1) which setting is correct out of the box (to ignore whitespace or not)
2) how do I set SS to validate accounting for whitespace
3) is there a schema tag I can use to ignore whitespace for numerics (I think there is, but am not sure of what the syntax of a tag would be).

Thanks for any help you can provide on this.

Postnext
Alberto MassariSubject: Re: XSD Validation
Author: Alberto Massari
Date: 27 Jul 2006 02:19 PM
Hi Doug,

At 13.58 27/07/2006 -0400, stylus-studio-tech Listmanager wrote:
>From: "Doug Hubbard" <<mailto:doug@trackmaster.com>doug@trackmaster.com>
>
>I am having an issue in that XML I am generating validates against
>the XSD fine in Stylus studio and in a custom C# app I have written,
>but when developers at our parent company use XML Spy (I didn't pick
>it, but am stuck with them using it) The docs fail to validate due
>to whitespace in numeric fields.
>
>As an example I have a node in my Schema named PAR_TIME
><xs:element name="PAR_TIME" type="xs:decimal"/>
>If the node is <PAR_TIME>51.98 </PAR_TIME> XML Spy fails (but Stylus
>does not) yet if the node is <PAR_TIME>51.98</PAR_TIME> both work.
>
>I have a couple of questions about this
>1) which setting is correct out of the box (to ignore whitespace or not)

In this case the correct operation is to ignore the whitespace (both
leading and trailing) as the xs:decimal data type is defined as
having the 'collapse' whiteSpace facet

<xs:simpleType name="decimal" id="decimal">
<xs:restriction base="xs:anySimpleType">
<xs:whiteSpace fixed="true" value="collapse" id="decimal.whiteSpace"/>
</xs:restriction>
</xs:simpleType>


>2) how do I set SS to validate accounting for whitespace

You cannot change this feature, as it is mandated by the XMLSchema spec

>3) is there a schema tag I can use to ignore whitespace for numerics
>(I think there is, but am not sure of what the syntax of a tag would be).

I don't know why XMLSpy doesn't collapse the whitespace for
xs:decimal; you can try to define and use a restriction where this
facet is explicit

<xs:simpleType name="collapsed_decimal">
<xs:restriction base="xs:decimal">
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="PAR_TIME" type="collapsed_decimal"/>

If XMLSpy still fails to parse your XML, I guess you will have to contact them.
Hope this helps,
Alberto

Posttop
Doug HubbardSubject: Re: XSD Validation
Author: Doug Hubbard
Date: 27 Jul 2006 02:23 PM
Alberto,
Thanks very much (I had actually just found the w3 spec).

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

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