  | |  | Invalid anyURI type - A Bug Or Intended to Be | Invalid anyURI type - A Bug Or Intended to Be 2003-03-28 - By Cao, Dekun
But this will cause some problems if the schema file is located in a directory which contains a white space, such as on Windows. Based on "Uniform Resource Identifiers (URI): Generic Syntax" http://www.ietf.org/rfc/rfc2396.txt, white space is NOT allowed in URI. I have verified that white space in schema file path doesn't work with the code at the end of this message.
My Question here is: Is this a bug or it is intended to do that?
Thank you very much.
Dekun
import org.apache.xerces.parsers.DOMParser; import org.w3c.dom.Document; import org.xml.sax.InputSource;
/** * Example tested with Xerces 2.0.0 */ public class MyDomTest { public static void main(String[] args) throws Exception { // get hold of a DOM parser DOMParser parser = new DOMParser();
// turn on schema validation ( note need to set both sax and dom validation ) parser.setFeature("http://apache.org/xml/features/validation/schema", true );
// The following path works // String xsdFile = new String("S:/myFile.xsd");
// The following path doesn't works String xsdFile = new String("C:\\Program Files\\myFile.xsd"); // NOT working parser.setProperty("http://apache.org/xml/properties/schema/external-noNames paceSchemaLocation" , xsdFile);
// parse the document InputSource is = new InputSource( "S:\\myMsgs_en.xml" ); parser.parse( is );
// get the w3c document Document doc = parser.getDocument(); } }
-----Original Message----- From: Sandy Gao [mailto:sandygao@(protected)] Sent: Friday, March 28, 2003 1:40 PM To: xerces-j-user@(protected) Subject: Re: Invalid anyURI type
No, "M:\software_development\xml\xsd\custom.xsd" is not a URI. "file:///M:/software_development/xml/xsd/custom.xsd" is.
Sandy Gao Software Developer, IBM Canada (1-905) 413-3255 sandygao@(protected)
"Thropp, Shawn"
<thropp@(protected) To: "'xerces-j-user@(protected)'" <xerces-j-user@(protected)> g> cc:
Subject: Invalid anyURI type
03/28/2003 01:08
PM
Please respond to
xerces-j-user
In the past I have been trying to set the external-schemaLocation Property and I understand there have been several bugs reported. I am not sure if the particular problem that I am having is a bug in Xerces-J or the way I am trying to create and use a DOM Parser and external-scheamLocation property.
In our implementation I set the external-schemaLocation property to a string that contains the all of the namespaces and XSDs to use (in the proper format). For a sanity check, I get the extenal-schemaLocation property after I set to verify it got set correctly. It seems to be setting it correctly.
When that actual parser begins doing its job, I receive the following error: FAILED: cvc-datatype-valid.1.2.1: 'M:\software_development\xml\xsd\custom.xsd' is not a valid 'anyURI' value. line: -1, col: -1
The XSDs all exist locally on my system. Is the string, in the error message, a valid URI? Or is there a bug with the handling of the external-schemaLocation property?
Thanks for the help Schawn
--------------------------------------------------------------------- To unsubscribe, e-mail: xerces-j-user-unsubscribe@(protected) For additional commands, e-mail: xerces-j-user-help@(protected)
--------------------------------------------------------------------- To unsubscribe, e-mail: xerces-j-user-unsubscribe@(protected) For additional commands, e-mail: xerces-j-user-help@(protected)
This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=US-ASCII"> <META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2654.89"> <TITLE>RE: Invalid anyURI type - A Bug Or Intended to Be</TITLE> </HEAD> <BODY>
<P><FONT SIZE=2>But this will cause some problems if the schema file is located in a directory which contains a white space, such as on Windows. Based on " ;Uniform Resource Identifiers (URI): Generic Syntax" <A HREF="http://www .ietf.org/rfc/rfc2396.txt" TARGET="_blank">http://www.ietf.org/rfc/rfc2396.txt< /A>, white space is NOT allowed in URI. I have verified that white space in schema file path doesn't work with the code at the end of this message.</FONT>< /P>
<P><FONT SIZE=2>My Question here is: Is this a bug or it is intended to do that ?</FONT> </P>
<P><FONT SIZE=2>Thank you very much.</FONT> </P>
<P><FONT SIZE=2>Dekun</FONT> </P> <BR>
<P><FONT SIZE=2>import org.apache.xerces.parsers.DOMParser;</FONT> <BR><FONT SIZE=2>import org.w3c.dom.Document;</FONT> <BR><FONT SIZE=2>import org.xml.sax.InputSource;</FONT> </P>
<P><FONT SIZE=2>/**</FONT> <BR><FONT SIZE=2> * Example tested with Xerces 2.0.0</FONT> <BR><FONT SIZE=2> */</FONT> <BR><FONT SIZE=2>public class MyDomTest</FONT> <BR><FONT SIZE=2>{</FONT> <BR><FONT SIZE=2> public static void main(String[] args) throws Exception </FONT> <BR><FONT SIZE=2> {</FONT> <BR><FONT SIZE=2> // get hold of a DOM parser</FONT> <BR><FONT SIZE=2> DOMParser parser = new DOMParser();</FONT> </P>
<P><FONT SIZE=2> // turn on schema validation ( note need to set both sax and dom validation )</FONT> <BR><FONT SIZE=2> parser.setFeature("<A HREF="http:/ /apache.org/xml/features/validation/schema" TARGET="_blank">http://apache.org /xml/features/validation/schema</A>", true );</FONT> </P>
<P><FONT SIZE=2> // The following path works</FONT> <BR><FONT SIZE=2>// String xsdFile = new String( "S:/myFile.xsd");</FONT> </P>
<P><FONT SIZE=2> // The following path doesn't works</FONT> <BR> <FONT SIZE=2>String xsdFile = new String("C:\\Program Files\\myFile.xsd"); // NOT working</FONT> <BR> <BR> <FONT SIZE=2>parser.setProperty( "<A HREF="http://apache.org/xml/properties/schema/external -noNamespaceSchemaLocation" TARGET="_blank">http://apache.org/xml/properties /schema/external-noNamespaceSchemaLocation</A>"</FONT> <BR> <FONT SIZE=2>, xsdFile);</FONT> </P>
<P><FONT SIZE=2> // parse the document</FONT> <BR><FONT SIZE=2> InputSource is = new InputSource( "S:\ \myMsgs_en.xml" );</FONT> <BR><FONT SIZE=2> parser.parse( is );</FONT> </P>
<P><FONT SIZE=2> // get the w3c document</FONT> <BR><FONT SIZE=2> Document doc = parser.getDocument();</FONT> <BR><FONT SIZE=2> }</FONT> <BR><FONT SIZE=2>}</FONT> </P> <BR>
<P><FONT SIZE=2>-----Original Message-----</FONT> <BR><FONT SIZE=2>From: Sandy Gao [<A HREF="mailto:sandygao@(protected)">mailto :sandygao@(protected)</A>]</FONT> <BR><FONT SIZE=2>Sent: Friday, March 28, 2003 1:40 PM</FONT> <BR><FONT SIZE=2>To: xerces-j-user@(protected)</FONT> <BR><FONT SIZE=2>Subject: Re: Invalid anyURI type</FONT> </P> <BR>
<P><FONT SIZE=2>No, "M:\software_development\xml\xsd\custom.xsd" is not a URI.</FONT> <BR><FONT SIZE=2>"<A HREF="file:///M:/software_development/xml/xsd/custom .xsd" TARGET="_blank">file:///M:/software_development/xml/xsd/custom.xsd</A> " is.</FONT> </P>
<P><FONT SIZE=2>Sandy Gao</FONT> <BR><FONT SIZE=2>Software Developer, IBM Canada</FONT> <BR><FONT SIZE=2>(1-905) 413-3255</FONT> <BR><FONT SIZE=2>sandygao@(protected)</FONT> </P> <BR> <BR>
<P><FONT SIZE=2> < /FONT></P>
<P><FONT SIZE=2> "Thropp, Shawn" </FONT></P>
<P><FONT SIZE=2> <thropp @(protected) To: "'xerces-j-user@(protected)'" <xerces-j-user@(protected) .apache.org> </FONT></P>
<P><FONT SIZE=2> g> cc: </FONT></P>
<P><FONT SIZE=2> Subject: Invalid anyURI type </FONT></P>
<P><FONT SIZE=2> 03/28/2003 01 :08   ; </FONT></P>
<P><FONT SIZE=2> PM   ; </FONT></P>
<P><FONT SIZE=2> Please respond to </FONT> </P>
<P><FONT SIZE=2> xerces-j-user </FONT></P>
<P><FONT SIZE=2> < /FONT></P>
<P><FONT SIZE=2> < /FONT></P> <BR> <BR>
<P><FONT SIZE=2>In the past I have been trying to set the external -schemaLocation Property</FONT> <BR><FONT SIZE=2>and I understand there have been several bugs reported. I am not sure if</FONT> <BR><FONT SIZE=2>the particular problem that I am having is a bug in Xerces-J or the way I</FONT> <BR><FONT SIZE=2>am</FONT> <BR><FONT SIZE=2>trying to create and use a DOM Parser and external -scheamLocation property.</FONT> </P>
<P><FONT SIZE=2>In our implementation I set the external-schemaLocation property to a</FONT> <BR><FONT SIZE=2>string</FONT> <BR><FONT SIZE=2>that contains the all of the namespaces and XSDs to use (in the proper</FONT> <BR><FONT SIZE=2>format). For a sanity check, I get the extenal -schemaLocation property</FONT> <BR><FONT SIZE=2>after I set to verify it got set correctly. It seems to be setting it</FONT> <BR><FONT SIZE=2>correctly.</FONT> </P>
<P><FONT SIZE=2>When that actual parser begins doing its job, I receive the following</FONT> <BR><FONT SIZE=2>error:</FONT> <BR><FONT SIZE=2>FAILED: cvc-datatype-valid.1.2.1:</FONT> <BR><FONT SIZE=2>'M:\software_development\xml\xsd\custom.xsd' is not a valid 'anyURI' value.</FONT> <BR><FONT SIZE=2>line: -1, col: -1</FONT> </P>
<P><FONT SIZE=2>The XSDs all exist locally on my system. Is the string, in the error</FONT> <BR><FONT SIZE=2>message, a valid URI? Or is there a bug with the handling of the</FONT> <BR><FONT SIZE=2>external-schemaLocation property?</FONT> </P>
<P><FONT SIZE=2>Thanks for the help</FONT> <BR><FONT SIZE=2>Schawn</FONT> </P>
<P><FONT SIZE=2>--------------------------------------------------------------- ------</FONT> <BR><FONT SIZE=2>To unsubscribe, e-mail: xerces-j-user-unsubscribe@(protected) .org</FONT> <BR><FONT SIZE=2>For additional commands, e-mail: xerces-j-user-help@(protected) .org</FONT> </P> <BR> <BR> <BR> <BR>
<P><FONT SIZE=2>--------------------------------------------------------------- ------</FONT> <BR><FONT SIZE=2>To unsubscribe, e-mail: xerces-j-user-unsubscribe@(protected) .org</FONT> <BR><FONT SIZE=2>For additional commands, e-mail: xerces-j-user-help@(protected) .org</FONT> </P>
<P><FONT SIZE=2>This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you.</FONT></P>
</BODY> </HTML>
|
|
 |