473,383 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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 1816
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Larry | last post by:
I believe the .Net XmlValidatingReader should fail when validating XML that contains a ComplexType element with white space when the ComplexType element has the mixed attribute set to false in the...
18
by: Vlad | last post by:
I have the following code: I have a local copy of the DTD that I need to validate incoming XML documents against. The XML document has the <!DOCTYPE myname SYSTEM "myfile.dtd"> define. When the...
0
by: Harold Putman | last post by:
The XmlValidatingReader seems to have changed drastically in .Net Frameworks 1.0 SP3 and beyond with regards to validating XML files that are XML Schemas. Consider the following code: ---...
9
by: jason | last post by:
how do you use the XmlValidatingReader to validate an XML document that is passed into the XmlValidatingReader constructor? it looks like the normal process is to use an underlying reader, as...
5
by: Geoff | last post by:
I am using an XMLValidatingReader to validate an XML file received via a web service. I want to verify that the incoming file matches the XML schema. When testing the validation routine, the...
1
by: Bernhard Felkel | last post by:
I have troubles validating XML files with key/keyref constraints. HereĀ“s my schema: <?xml version="1.0" encoding="utf-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"...
1
by: Plop69 | last post by:
need some help on following: xml file 1 <TEST xmlns="http://test" > <OK>mlkddflmkj</OK> </TEST> xml file 2
12
by: Plop69 | last post by:
need some help on following: xml file 1 <TEST xmlns="http://test" > <OK>mlkddflmkj</OK> </TEST>
1
by: JoeZ | last post by:
Hi all, I have a question about using XMLValidatingReader. I have a schema files (xsd), and a xml data file. In the xml data file, if I don't specify the schema file path, XMLValidatingReader...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.