You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by tomer_shim <to...@hotmail.com> on 2008/04/27 19:20:37 UTC

Invalid URI when backslashes in path and not slashes

Hello,

I'm getting the error "<some_path> is NOT a valid URI".
An example path is: file:///c:\testing\bla.jpg .

It seems that when I try to replace all the '\' with '/' it works. Why a
path with backslashes isn't doesn't pass validation?

Thank you for the support.
-- 
View this message in context: http://www.nabble.com/Invalid-URI-when-backslashes-in-path-and-not-slashes-tp16926097p16926097.html
Sent from the Xerces - C - Users mailing list archive at Nabble.com.


Re: Invalid URI when backslashes in path and not slashes

Posted by tomer_shim <to...@hotmail.com>.
Thank you for the help. I've done as you suggested.

Have a nice week!


John Snelson-4 wrote:
> 
> I would suggest changing the schema to use xs:string rather than 
> xs:anyURI, which would make your document schema valid.
> 
> Changing Xerces-C may work for you, but noone else would be able to use 
> your schema - you'd essentially only have a proprietary in-house solution.
> 
> John
> 
> tomer_shim wrote:
>> Thats what i suspected, what is the recommended solution in this
>> situation? I
>> cant change the xml so im left with changing the schema or xerces
> 
> 
> -- 
> John Snelson, Oracle Corporation            http://snelson.org.uk/john
> Berkeley DB XML:            http://oracle.com/database/berkeley-db/xml
> XQilla:                                  http://xqilla.sourceforge.net
> 
> 

-- 
View this message in context: http://www.nabble.com/Invalid-URI-when-backslashes-in-path-and-not-slashes-tp16926097p16945880.html
Sent from the Xerces - C - Users mailing list archive at Nabble.com.


Re: Invalid URI when backslashes in path and not slashes

Posted by John Snelson <jo...@oracle.com>.
I would suggest changing the schema to use xs:string rather than 
xs:anyURI, which would make your document schema valid.

Changing Xerces-C may work for you, but noone else would be able to use 
your schema - you'd essentially only have a proprietary in-house solution.

John

tomer_shim wrote:
> Thats what i suspected, what is the recommended solution in this situation? I
> cant change the xml so im left with changing the schema or xerces


-- 
John Snelson, Oracle Corporation            http://snelson.org.uk/john
Berkeley DB XML:            http://oracle.com/database/berkeley-db/xml
XQilla:                                  http://xqilla.sourceforge.net

Re: Invalid URI when backslashes in path and not slashes

Posted by tomer_shim <to...@hotmail.com>.
Thats what i suspected, what is the recommended solution in this situation? I
cant change the xml so im left with changing the schema or xerces
-- 
View this message in context: http://www.nabble.com/Invalid-URI-when-backslashes-in-path-and-not-slashes-tp16926097p16936524.html
Sent from the Xerces - C - Users mailing list archive at Nabble.com.


Re: Invalid URI when backslashes in path and not slashes

Posted by Boris Kolpackov <bo...@codesynthesis.com>.
Hi Michael,

Michael Glavassevich <mr...@ca.ibm.com> writes:

> If Xerces-C rejects it then it has a bug.

I've created a bug report:

https://issues.apache.org/jira/browse/XERCESC-1801

Thanks,
Boris

-- 
Boris Kolpackov, Code Synthesis Tools   http://codesynthesis.com/~boris/blog
Open source XML data binding for C++:   http://codesynthesis.com/products/xsd
Mobile/embedded validating XML parsing: http://codesynthesis.com/products/xsde

Re: Invalid URI when backslashes in path and not slashes

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Backslashes aren't allowed in URIs, however the XML schema type xs:anyURI
[1] allows much more than the URI RFC. Specifically it's lexical space is
defined as "finite-length character sequences which, when the algorithm
defined in Section 5.4 of [XML Linking Language] is applied to them, result
in strings which are legal URIs according to [RFC 2396], as amended by [RFC
2732]." Backslashes are not interpreted as path separators but they are
allowed in xs:anyURI values. Xerces-J accepts "file:///c:\testing\bla.jpg"
as a valid xs:anyURI value. If Xerces-C rejects it then it has a bug.

Thanks.

[1] http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#anyURI

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

John Snelson <jo...@oracle.com> wrote on 04/28/2008 05:26:17 AM:

> This doesn't validate because backslashes aren't valid in URIs. It's
> common to find URI implementations that accept backslashes and deal with
> them, but that doesn't mean they are valid.
>
> John
>
> tomer_shim wrote:
> > Hello,
> >
> > I'm getting the error "<some_path> is NOT a valid URI".
> > An example path is: file:///c:\testing\bla.jpg .
> >
> > It seems that when I try to replace all the '\' with '/' it works. Why
a
> > path with backslashes isn't doesn't pass validation?
> >
> > Thank you for the support.
>
>
> --
> John Snelson, Oracle Corporation            http://snelson.org.uk/john
> Berkeley DB XML:            http://oracle.com/database/berkeley-db/xml
> XQilla:                                  http://xqilla.sourceforge.net

Re: Invalid URI when backslashes in path and not slashes

Posted by John Snelson <jo...@oracle.com>.
This doesn't validate because backslashes aren't valid in URIs. It's 
common to find URI implementations that accept backslashes and deal with 
them, but that doesn't mean they are valid.

John

tomer_shim wrote:
> Hello,
> 
> I'm getting the error "<some_path> is NOT a valid URI".
> An example path is: file:///c:\testing\bla.jpg .
> 
> It seems that when I try to replace all the '\' with '/' it works. Why a
> path with backslashes isn't doesn't pass validation?
> 
> Thank you for the support.


-- 
John Snelson, Oracle Corporation            http://snelson.org.uk/john
Berkeley DB XML:            http://oracle.com/database/berkeley-db/xml
XQilla:                                  http://xqilla.sourceforge.net