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

Validation of anyURI

Sab
Hi,
I'm writing a rendering layer for asp.net apps that renders xdime markup. I
need all URLs used in the app to be absolute or relative. Whenever I use an
absolute URL, something like '/myPage/LogOut.aspx' as an attribute of type
anyURI the document validation fails with the error 'attribute has an invalid
value according to its data type'.
If I remove the leading '/' then the .Net reader validates the file fine.
Altova XmlSpy is happy to validate the xml irrespective of the leading '/'.
The schema I am validating agains belongs to someone else, so I cannot
change the type of the anyURI attributes.
Is this behaviour correct? Is there any way to get the .Net validator to
understand that absolute URIs are valid?
Thanks for reading,
Sab
Nov 12 '05 #1
1 1793
"Sab" <Sa*@discussions.microsoft.com> wrote in message news:91**********************************@microsof t.com...
absolute URL, something like '/myPage/LogOut.aspx' as an attribute of type
anyURI the document validation fails with the error 'attribute has an invalid
value according to its data type'. : : Is this behaviour correct?
XML Schema : Part 2, sect. 3.2.17.1, basically states that the formatting of
an xs:anyURI value must meet the requirements of RFC2396.

RFC2396, section 5 governing relative references identifies a URI starting
with a single '/' as an abs_path, which is an absolute reference without a
scheme (which otherwise couldn't be empty) or colon.

Therefore, I'd conclude it's incorrect for the validator to rule the value
invalid.
Is there any way to get the .Net validator to understand that absolute
URIs are valid?


I would wrap your input source in a custom XmlTextReader that strips
leading '/' off of attribute values it reports to the XmlValidatingReader.
Inject this custom XmlTextReader as a filter between the XmlValidating
Reader and your input source.

Subclass XmlTextReader and override the properties and methods
that access individual attributes. Whenever the consumer asks your
custom XmlTextReader for an attribute value, strip off the leading '/'
if it has one and return the modified value. In this way, XmlValidating-
Reader will only see relative references that it can accept as valid.
Derek Harmon
Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Stefan Richter | last post by:
Hi, after coding for days on stupid form validations - Like: strings (min / max length), numbers(min / max value), money(min / max value), postcodes(min / max value), telefon numbers, email...
2
by: Hrvoje Somun | last post by:
i am trying to use file on local computer as xsd, but my java program always throws; URI file:C:/data.xml cvc-datatype-valid.1.2.1: 'C:\shemadata.xsd' is not a valid value for 'anyURI'. only...
2
by: wumingshi | last post by:
Hi, When validating an XML instance, sometimes the schema is not enough to expression the validation rules. Additional validation rules may be expressed in an application-specific way. For...
4
by: Tim Meagher | last post by:
I am trying to use both validation controls and to add submit button attributes, but when I add the button attributes, the javascript fpr the validation controls is no longer created for the page. ...
3
by: dfielder | last post by:
I'm using the latest version of Xerces-J and parsing an XML file using the 'org.apache.xerces.parsers.SAXParser' parser. The problem I have is that a value such as 'file:///c:/#test#.jpg' is...
1
by: Erik Cruz | last post by:
A custom xml file I wrote for my application has two elements that accepts urls. I used vs.net to generate a schema file for my file but there is no validation for urls. How can I validate an...
14
by: Matt | last post by:
I want to know if ASP.NET Web Forms Validation Controls are Server-Side or Client-Side form validation? Since I think each validator control can select either 1) JavaScript based error dialog or 2)...
1
by: Kenny Ho | last post by:
Hi, I have written the following schema that contains the XML signature: ----------------------------------------------------------------------- <?xml version="1.0" encoding="utf-8" ?>...
0
by: Sanjaya | last post by:
Hi, I need to have a web method with a string parameter. I need this to be serialized as 'anyURI' type instead of 'string' type. how can i do this ? regard Sanjaya
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.