Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Path question

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: David Forslund <forslund AT mail.com>
  • To: xom-interest <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] Path question
  • Date: Thu, 20 Oct 2005 06:46:08 -0600

Converting to a File object "cured" the problem. I've been converting some old code to use XOM and had this slight incompatibility.

Thanks,

Dave
Elliotte Harold wrote:

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.







Archive powered by MHonArc 2.6.24.

Top of Page