Hi Dekun, That's true white space is not allowed to appear in a URI, however you can encode them with an escape sequence. The escape sequence for whitespace is %20. So if your schema is located at C:\My Schemas\my schema.xsd, a valid URI which refers to such a file is file:///C:/My%20Schemas\my%20schema.xsd
>On Fri, 28 Mar 2003, Cao, Dekun wrote: > >> 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:[EMAIL PROTECTED] >> Sent: Friday, March 28, 2003 1:40 PM >> To: [EMAIL 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 >> [EMAIL PROTECTED] >> >> >> >> >> >> "Thropp, Shawn" >> >> <[EMAIL PROTECTED] To: >> "'[EMAIL PROTECTED]'" <[EMAIL 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: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL 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. >> ----------------------------- Michael Glavassevich [EMAIL PROTECTED] 4B Computer Engineering University of Waterloo --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]