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

anyURI validation failing in Xerces-J

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 failing validation
as xs:anyURI. What's interesting is that if I remove one of the pound
signs, it validates just fine. The string with two pound signs
validates with no problem in XMLSpy. Any ideas what's going on here?
Here's the exact error coming out of the SAXParser:

[Error] test.xml:9:48: cvc-datatype-valid.1.2.1:
'file:///c:/#test#.jpg' is not a valid value for 'anyURI'

If this is the wrong area to post this question, please let me know a
more suitable place. Thanks for any help in advance.

Nov 10 '05 #1
3 2483
In article <11*********************@g49g2000cwa.googlegroups. com>,
<df******@gmail.com> wrote:
[Error] test.xml:9:48: cvc-datatype-valid.1.2.1:
'file:///c:/#test#.jpg' is not a valid value for 'anyURI'


The # symbol is used to separate the main part of a URI from the fragment
identifier, for example http://www.w3.org/TR/REC-xml/#sec-intro.

You need to encode your # characters as %23:

file:///c:/%23test%23.jpg

The reason it works if you remove, say, the second # is that it is
interpreting it as the test.jpg fragment of file:///c:/.

-- Richard
Nov 10 '05 #2
May be I miss something, but shouldn't it be : file://c:/#test#.jpg ?
And also I think the # caracter is maybe reserved (this is anchor for
sample with HTML and it is at the end part of the URL).

Best regards,

A.Brillant
EditiX - XML Editor and XSLT Debugger
http://www.editix.com

df******@gmail.com wrote:
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 failing validation
as xs:anyURI. What's interesting is that if I remove one of the pound
signs, it validates just fine. The string with two pound signs
validates with no problem in XMLSpy. Any ideas what's going on here?
Here's the exact error coming out of the SAXParser:

[Error] test.xml:9:48: cvc-datatype-valid.1.2.1:
'file:///c:/#test#.jpg' is not a valid value for 'anyURI'

If this is the wrong area to post this question, please let me know a
more suitable place. Thanks for any help in advance.

Nov 23 '05 #3
In article <dl**********@aphrodite.grec.isp.9tel.net>,
JAPISoft <br****************@neuf.fr> wrote:
May be I miss something, but shouldn't it be : file://c:/#test#.jpg ?


No, it's an example of file://hostname/... where the hostname
part is empty.

-- Richard
Nov 23 '05 #4

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

Similar topics

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: Olaf Meyer | last post by:
Apprentently xerces 2.6.0 (Java) does not validate against contraints specified in the schema (e.g. constraints specified via unique element). The validation works with the XML editor I'm using...
0
by: Brian | last post by:
I am having alot of trouble getting a XML document validated with a schema. I got a sample document and schema off of w3schools.com, which passed an online xml validator:...
0
by: motoman | last post by:
I have a problem with the code sample below, basically when i run it i get the error classnotfoundexception org.apache.xerces.parsers.SAXParser now i know the simple answer is declare xerces.jar...
4
by: Oskar Stuffer | last post by:
Hi! I'm using the msv tool which uses xerces to validate a XML document against a XML Schema definition. This is my XML Schema definition: <?xml version="1.0" encoding="ISO-8859-1"?>...
1
by: Sab | last post by:
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...
1
by: mrc-1 | last post by:
Hello, I built a XSD File with the tool XML-Spy from Altova. My XML file consists of about 5000 elements. If I use the validate button in XML-Spy, the validation process takes about 8 seconds....
7
by: christian.eickhoff | last post by:
Hi Everyone, I am currently implementing an XercesDOMParser to parse an XML file and to validate this file against its XSD Schema file which are both located on my local HD drive. For this...
9
by: mstilli | last post by:
Hi, I am trying to use schema for server side validation using xerces to catch the validation errors. validating this XML: <Content4> <textarea13></textarea13>...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...

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.