File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes Unable to parse xml file with # in the filename Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Unable to parse xml file with # in the filename" Watch "Unable to parse xml file with # in the filename" New topic
Author

Unable to parse xml file with # in the filename

Kathy Alam
Greenhorn

Joined: May 20, 2003
Posts: 2
When I try to parse an XML file with a # in the filename, (e.g. 00000291-00000001-00000117-C@#Test#1MB.xml), I get the following error:
java.net.MalformedURLException: unknown protocol: c
at java.net.URL.<init>(URL.java:507)
at java.net.URL.<init>(URL.java:403)
at java.net.URL.<init>(URL.java:357)
at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.startDocumentEntity(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl.setInputSource(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
Do I have to rename the XML without the # characters or is there some other way?
Thanks.
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Can you post your file opening java code ?


Spritle Software Blogs
Kathy Alam
Greenhorn

Joined: May 20, 2003
Posts: 2
public static void main(String args[])
{
// Load the XML file
try
{
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(args[0]);
System.out.println("success");
//PDFConverterHandler pdf = new PDFConverterHandler();
//System.out.println(pdf.convert(args[0]));
}
catch (Exception e)
{
e.printStackTrace();
}
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to parse xml file with # in the filename