I've tried simplifying the test by attempting to parse a document without a dtd reference.
<?xml version="1.0"?> <test>sample</test> The java code I use, which still results in an exception is: log.debug("TRYING TO PARSE SIMPLE DOCUMENT..."); SAXBuilder builder = new SAXBuilder(false); builder.setIgnoringElementContentWhitespace(true); builder.setFeature("http://xml.org/sax/features/validation", false); String testDoc = "test.xml"; try { Document doc = builder.build(getClass().getResourceAsStream(testDoc)); //I never get here! log.debug("Successfully parsed test document!"); } catch (JDOMException jdome) { Throwable root = jdome.getCause(); if (root != null) { log.error("Root cause:" + root.getMessage()); } log.error("Failed to parse " + testDoc + " file", root); } --- Michael Rafael Glavassevich <[EMAIL PROTECTED]> wrote: > Hi Jon, > > It would be great if you posted a snippet of code > before and including > the invocation of SAXBuilder.build, in order to > diagnose your problem. It > seems that there is something wrong with the > location specified for your > XML file (either an invalid URI, or java.net.URL > doesn't recognize the > protocol/scheme of the URI). In either case, Xerces > is unable to read > your file. > > As a separate issue, I noticed that the system ID > that you specified for > your DTD is not a valid URI. It should be > "file:///C:/temp/projects/EventRegistrations.dtd" > instead of > "file:///C:\temp\projects\EventRegistrations.dtd" > ('\' isn't a valid URI > character). Xerces (by default) will fix up the > system ID before it's > used. However, if you want your documents to be > portable across different > XML parsers, then you need to make sure that URIs > you specify actually > meet the URI spec. > > Hope that helps. > > ----------------------------------------- > Michael Glavassevich > [EMAIL PROTECTED] > Candidate for Bachelor of Applied Science > Computer Engineering > University of Waterloo > > On Sat, 24 May 2003, Jon Wilmoth wrote: > > > I'm trying to parse a very simple xml document > with > > xerces 2.4.0. Unfortunately I get the following > > error: > > > > java.net.MalformedURLException > > at java.net.URL.<init>(URL.java:613) > > at java.net.URL.<init>(URL.java:476) > > at java.net.URL.<init>(URL.java:425) > > at > > > org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown > > Source) > > at > > > org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown > > Source) > > at > > > org.apache.xerces.parsers.XML11Configuration.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.AbstractSAXParser.parse(Unknown > > Source) > > at > > > org.jdom.input.SAXBuilder.build(SAXBuilder.java:354) > > at > > > org.jdom.input.SAXBuilder.build(SAXBuilder.java:673) > > > > The document: > > <?xml version="1.0"?> > > <!DOCTYPE EventRegistrations SYSTEM > > "file:///C:\temp\projects\EventRegistrations.dtd"> > > <EventRegistrations> > > <event > name="test.events.BusinessObjectChangeEvent"> > > <listener>test.ObjectCreationListener</listener> > > </event> > > </EventRegistrations> > > > > Passes validation in my xml editor. What's going > on? > > __________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]