xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
- From: Elliotte Harold <elharo AT metalab.unc.edu>
- To: David Forslund <forslund AT mail.com>
- Cc: xom-interest <xom-interest AT lists.ibiblio.org>
- Subject: Re: [XOM-interest] Path question
- Date: Thu, 20 Oct 2005 06:40:49 -0400
David Forslund wrote:
I'm trying to use XOM in a webapp and all ServletContext.getRealPath() to get the path to an XML file to process. I'm doing this on windows. It yields a path with "\" in it as is normal on windoes. But I get the following error:
nu.xom.ParsingException: Path contains invalid character: \ in C:\Java\resin-2.1.9\webapps\b-safer\WEB-INF/classes/xcode/symptoms.xml
at nu.xom.Builder.build(Builder.java:1170)
at nu.xom.Builder.build(Builder.java:562)
at gov.lanl.Utility.xml.Resource.setXMLDOMSource(Resource.java:121)
Hard to tell without seeing your code, but two things suggest themselves. First XOM s not DOM, and the method name "setXMLDOMSource" suggests that might be your problem.
Second the exception you're getting is just propagated from the underlying SAX parser. You're supposed to be passing a URL into the build() method.A path, especially a Windows path, is not a URL; and \ is not a legal character in URLs. Hence the error message. Convert the path to a file URL or use the Build method that takes a File object instead.
--
Elliotte Rusty Harold elharo AT metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim
-
Re: [XOM-interest] Path question,
David Forslund, 10/20/2005
-
Re: [XOM-interest] Path question,
Elliotte Harold, 10/20/2005
- Re: [XOM-interest] Path question, David Forslund, 10/20/2005
-
Re: [XOM-interest] Path question,
Elliotte Harold, 10/20/2005
Archive powered by MHonArc 2.6.24.