468,136 Members | 1,435 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,136 developers. It's quick & easy.

XMLValidatingReader - How to disable range checking

MT
Hi,

I am currently validating an XML file against a Schema using
XMLValidatingReader. The schema actually contains ranges for particular
elements and I have been using it to detect range errors before it gets to
my program. The way the rangechecking works is that every element that needs
range checking is defined as an element with a particular type in the XSD.
For example,
<xs:element name="Row" maxOccurs="48">

<xs:complexType>

<xs:sequence>

<xs:element name="Price" type="PriceType" default="0"
minOccurs="0" />

</xs:element>

</xs:sequence>

</xs:complexType>

</xs:element>

The type has the range embedded within it:

<xs:simpleType name="PriceType">

<xs:restriction base="xs:double">

<xs:minInclusive value="0" />

<xs:maxInclusive value="0.002" />

</xs:restriction>

</xs:simpleType>

So, now when I validate my XML file against a schema using the
XMLValidatingReader, it will tell me if the value entered in the XML file is
valid or not.

However, I want to disable the rangechecking on my data for certain
operations. Is there any way I can do this?

I still want to detect if the user entered an invalid type or if the user
did not put in the correct xml tag. I just don't want the
XMLValidatingReader performing the rangechecking. If anybody knows how do do
this, please post a response.

Thanks,

MT


Nov 12 '05 #1
2 1598
The only way to customize the hehavior of the XmlValidatingReader is to
customize the schema itself.

"MT" <no****@nospam.com> wrote in message
news:u3**************@TK2MSFTNGP09.phx.gbl...
Hi,

I am currently validating an XML file against a Schema using
XMLValidatingReader. The schema actually contains ranges for particular
elements and I have been using it to detect range errors before it gets to
my program. The way the rangechecking works is that every element that needs range checking is defined as an element with a particular type in the XSD.
For example,
<xs:element name="Row" maxOccurs="48">

<xs:complexType>

<xs:sequence>

<xs:element name="Price" type="PriceType" default="0"
minOccurs="0" />

</xs:element>

</xs:sequence>

</xs:complexType>

</xs:element>

The type has the range embedded within it:

<xs:simpleType name="PriceType">

<xs:restriction base="xs:double">

<xs:minInclusive value="0" />

<xs:maxInclusive value="0.002" />

</xs:restriction>

</xs:simpleType>

So, now when I validate my XML file against a schema using the
XMLValidatingReader, it will tell me if the value entered in the XML file is valid or not.

However, I want to disable the rangechecking on my data for certain
operations. Is there any way I can do this?

I still want to detect if the user entered an invalid type or if the user
did not put in the correct xml tag. I just don't want the
XMLValidatingReader performing the rangechecking. If anybody knows how do do this, please post a response.

Thanks,

MT

Nov 12 '05 #2
MT wrote:
I still want to detect if the user entered an invalid type or if the user
did not put in the correct xml tag. I just don't want the
XMLValidatingReader performing the rangechecking. If anybody knows how do do
this, please post a response.

XmlValidatingReader doesn't perform rangechecking, it validates instance
document against schema. So you can have second "more lax" schema, which
imports first one but redefines appropriate definitions to lift the
range constraints.
--
Oleg Tkachenko
XML Insider
http://www.tkachenko.com/blog

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

18 posts views Thread by Vlad | last post: by
reply views Thread by Harold Putman | last post: by
9 posts views Thread by jason | last post: by
5 posts views Thread by Geoff | last post: by
1 post views Thread by Bernhard Felkel | last post: by
1 post views Thread by Plop69 | last post: by
1 post views Thread by JoeZ | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.