You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2004/03/01 21:25:08 UTC
DO NOT REPLY [Bug 27346] New: -
Can not load schema in documents defined by a file-URI containing '|' as drive identifier machines running a Microsoft OS
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27346>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27346
Can not load schema in documents defined by a file-URI containing '|' as drive identifier machines running a Microsoft OS
Summary: Can not load schema in documents defined by a file-URI
containing '|' as drive identifier machines running a
Microsoft OS
Product: Xerces2-J
Version: 2.6.2
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: Normal
Priority: Other
Component: Other
AssignedTo: xerces-j-dev@xml.apache.org
ReportedBy: l.buenger@gmx.de
On Microsoft machines it is possible to use an URI to an XML-file of the type
"file://c|folder1/folder2"
Note the '|'-character after the drive identifier!
When parsing an XML-file using such an URI Xerces-2-J (im using 2.6.2) does
well.
However: validating XML files referenced by such an URI
containing an '|' instead of an ':' against a schema defined in the XML file
causes the well known
cvc-elt.1: Cannot find the declaration of element Error if (and only if)
the XSD is given relative to the XML-file.
Since usage of '|' in Xerces is possible validation schould work with such URIs
too!
Steps to reproduce:
1) create an XML-file on your local filesystem with a schema in the same folder
referenced relative
2) load and parse an XML-file by providing an URI from the filesystem using
"file:///c|/path"
3) validate this XML-file using normalizeDocument()
change the '|' against a ':' and everything works proper again.
A closer analysis shows that XMLEntityManager.expandSystemId() in package
org.apache.xerces.impl instanciating an URI containing a '|' throws an
URI.MalformedURIException (which is actually correct behavior for such URIs).
A possible workaround -however not a good solution- is to add the
code marked by >>>> 'code' <<<< in XMLEntityManager.fixURI() prior to
instanciating the URI:
: protected static String fixURI(String str) {
:
: // handle platform dependent strings
: str = str.replace(java.io.File.separatorChar, '/');
>>>>>>
: str = str.replace('|', ':');
<<<<<<
However this workaround is
1) not very performant
2) possibly not the right place to handle such URIs
3) possibly not the only place where this should be considered
(e.g. in the expandSystemId method there is code checking for ':' too)
Thank you.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org