• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to parse xml file with # in the filename

 
Kathy Alam
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post your file opening java code ?
 
Kathy Alam
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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();
}
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic