[jdom-interest] error in bulding a document from an xml file usingSAX builder

Michael Kay mike at saxonica.com
Sun Aug 31 02:53:42 PDT 2008


The StringReader supplied to build() should contain the contents of the XML
document, not the name of the file containing the XML document.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: jdom-interest-bounces at jdom.org 
> [mailto:jdom-interest-bounces at jdom.org] On Behalf Of jdomuser
> Sent: 30 August 2008 10:25
> To: jdom-interest at jdom.org
> Subject: [jdom-interest] error in bulding a document from an 
> xml file usingSAX builder
> 
> 
> hello i m using new jdom1.1. I wanted to build a document 
> from an existing xml file, by giving its string path to SAX 
> builder's build method.
> 
> Document doc;
> String xmlfile = "c:\\tmp\\foo.xml";
> SAXBuilder builder = new SAXBuilder();
> builder.setValidation(true);
> builder.setIgnoringElementContentWhitespace(true);
>      try{       
>          doc = builder.build(new StringReader(xmlfile));           
>      } catch (JDOMException e) {  
>           System.out.println("Error in building JDOM file");
>      } catch (IOException e) {
>           System.out.println("Error in building JDOM file");
>      }
> 
> unfortunately, i got a JDOMException here. what do you think 
> about the reason?
> 
> regards.
> --
> View this message in context: 
> http://www.nabble.com/error-in-bulding-a-document-from-an-xml-
> file-using-SAX-builder-tp19226715p19226715.html
> Sent from the JDOM - General mailing list archive at Nabble.com.
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@you
> rhost.com



More information about the jdom-interest mailing list