views:

84

answers:

1

Hi,

I have get this exception. but this exception is not reproduced again. I want to get the cause of this

Exception Caught while Checking tag in XMLjava.net.URISyntaxException:
Illegal character in opaque part at index 2:
C:\Documents and Settings\All Users\.SF\config\sd.xml
stacktrace net.sf.saxon.trans.XPathException.

Why this exception occured. How to deal with so it will not reproduce.

+3  A: 

Basically "C:\Documents and Settings\All Users\.SF\config\sd.xml" is a pathname, and not a valid URI. If you want to turn a pathname into a "file:" URI, then do the following:

File f = new File("C:\Documents and Settings\All Users\.SF\config\sd.xml");
URI u = f.toURI();

This is the most reliable and portable way to do this. But you need to realize that "file:" URIs have a number of caveats, as described in the javadocs for the File.toURI() method. For example, a "file:" URI created on one machine usually denotes a different resource (or no resource at all) on another machine.

Stephen C