473,382 Members | 1,389 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,382 software developers and data experts.

XmlValidatingReader in v1.1

Hi,

I am using the XmlValidatingReader Class in VS.Net 2003 (targeting dotNet
v1.1) to validate an xml message against a set of schemas.

Within the schema a type is defined as follows

<xs:simpleType name="atypename">
<xs:restriction base="xs:token">
<xs:pattern value="\w{1,6}"/>
</xs:restriction>
</xs:simpleType>

The "\w" construct should allow all characters except the set of
"punctuation", "separator" and "other" characters.

The W3C documentation indicates that the underscore character is punctuation
and should therefore be excluded. However a validation event is not raised
when the content has an undescore character in it. I think this is probably a
result of the fact that in the Unicode recommendation it says that "\w"
should allow underscores because of its common use in programming languages.
However, I would have thought that XmlValidatingReader would follow the W3C
recommendation?

I can't see this listed as a known bug anywhere. Is this because it is not
seen as a bug?

Could someone tell me, if I change to use dotNet v2.0 will this behave in
the way recommended by the W3C or is the behaviour the same as in dotNet v1.1?

Many thanks

--
Phil Hobgen
Southampton, UK
Oct 31 '06 #1
2 1363
Phil Hobgen wrote:
I think this is probably a
result of the fact that in the Unicode recommendation it says that "\w"
should allow underscores because of its common use in programming languages.
Interesting, recently someone run into the problem with \w including the
"_" in some regular expression languages in programming
languages/libraries (e.g. JavaScript/ECMAScript, or the .NET framework
Regex class) but not in the XSD schema regular expression language. I
did not know about the Unicode recommendation. Do you happen to have a
link to that part?

Could someone tell me, if I change to use dotNet v2.0 will this behave in
the way recommended by the W3C or is the behaviour the same as in dotNet v1.1?
With .NET 2.0 with both the new XmlReader with the proper
XmlReaderSettings to validate and the (obsolete) XmlValidatingReader the
following does not validate:

<value>abc_de</value>

schema excerpt:

<xs:element name="value" maxOccurs="unbounded">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="\w{6}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>

Validation error message
"Error: The 'value' element is invalid - The value 'abc_de' is
invalid according to its datatype 'String' - The Pattern constraint failed..

So with .NET 2.0 \w in a pattern follows the W3C XSD schema
specification (at least as far as not including "_" in \w).

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Oct 31 '06 #2
"Martin Honnen" wrote:
Interesting, recently someone run into the problem with \w including the
"_" in some regular expression languages in programming
languages/libraries (e.g. JavaScript/ECMAScript, or the .NET framework
Regex class) but not in the XSD schema regular expression language. I
did not know about the Unicode recommendation. Do you happen to have a
link to that part?
http://www.unicode.org/unicode/repor...red_Properties
then scroll down a few pages to
Annex C: Compatibility Properties
You'll see the recommendation for \w and the comments mention "_"
So with .NET 2.0 \w in a pattern follows the W3C XSD schema
specification (at least as far as not including "_" in \w).
Great, at least I now know it is worth moving the app up to .Net v2.0

Many thanks for the speedy reply Martin.

--
Phil Hobgen
Southampton, UK
Nov 1 '06 #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...
1
by: Larry | last post by:
Reposting due to lack of response - I believe the .Net XmlValidatingReader should fail when validating XML that contains a ComplexType element with white space when the ComplexType element has the...
2
by: MT | last post by:
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...
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...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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.