• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Unable to parse xml file with # in the filename

 
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.
 
author and deputy
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();
}
}
 
Destiny's powerful hand has made the bed of my future. And this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!