throw new RuntimeException( "Error processing resource " + resource + ": " + e.getMessage(), e );
try { errorHandler.error(new SAXParseException( exception.getMessage(), null, exception));
throw new SAXException(e.getMessage(), e);
public QueryCapability readXML( String docAsString, URI uri ) throws IOException { // get ready for XML parsing warnMessages.setLength( 0 ); errMessages.setLength( 0 ); fatalMessages.setLength( 0 ); Document doc = null; try { doc = builder.build( new StringReader( docAsString ) ); } catch ( JDOMException e ) { fatalMessages.append( e.getMessage() ); // makes it invalid } return readXML( doc, uri ); }
public QueryCapability readXML( String docAsString, URI uri ) throws IOException { // get ready for XML parsing warnMessages.setLength( 0 ); errMessages.setLength( 0 ); fatalMessages.setLength( 0 ); Document doc = null; try { doc = builder.build( new StringReader( docAsString ) ); } catch ( JDOMException e ) { fatalMessages.append( e.getMessage() ); // makes it invalid } return readXML( doc, uri ); }
public QueryCapability readXML( String docAsString, URI uri ) throws IOException { // get ready for XML parsing warnMessages.setLength( 0 ); errMessages.setLength( 0 ); fatalMessages.setLength( 0 ); Document doc = null; try { doc = builder.build( new StringReader( docAsString ) ); } catch ( JDOMException e ) { fatalMessages.append( e.getMessage() ); // makes it invalid } return readXML( doc, uri ); }
private Element readContentFromURL(java.net.URI uri) throws java.io.IOException { if (saxBuilder == null) saxBuilder = new SAXBuilder(); Document doc; try { doc = saxBuilder.build(uri.toURL()); } catch (JDOMException e) { throw new IOException(e.getMessage()); } return doc.getRootElement(); }
private Element readContentFromURL(java.net.URI uri) throws java.io.IOException { if (saxBuilder == null) saxBuilder = new SAXBuilder(); Document doc; try { doc = saxBuilder.build(uri.toURL()); } catch (JDOMException e) { throw new IOException(e.getMessage()); } return doc.getRootElement(); }
private Element readContentFromURL(java.net.URI uri) throws java.io.IOException { if (saxBuilder == null) saxBuilder = new SAXBuilder(); Document doc; try { doc = saxBuilder.build(uri.toURL()); } catch (JDOMException e) { throw new IOException(e.getMessage()); } return doc.getRootElement(); }
public static void main(String[] args) { try { SAXBuilder b = new SAXBuilder(true); // true -> validate // Create a JDOM document. Document doc = b.build(new File("people+dtd.xml")); // Create an output formatter, and have it write the doc. new XMLOutputter().output(doc, System.out); } catch (JDOMException jex) { System.out.print("PARSE ERROR: " + jex.getMessage()); } catch (Exception ex) { ex.printStackTrace(); } } }
/** * Read an XML Document from a URL and return the root element. * * @param location the URL location * @return the root element of the Document * @throws java.io.IOException on read error */ static public Element readRootElement(String location) throws IOException { org.jdom2.Document doc; try { SAXBuilder builder = new SAXBuilder(); doc = builder.build(location); } catch (JDOMException e) { throw new IOException(e.getMessage()); } return doc.getRootElement(); }
public static void read(InputStream is, StringBuilder errlog) throws IOException { Document doc; SAXBuilder saxBuilder = new SAXBuilder(); try { doc = saxBuilder.build(is); } catch (JDOMException e) { throw new IOException(e.getMessage()); } read(doc.getRootElement(), errlog); }
public static void read(InputStream is, StringBuilder errlog) throws IOException { Document doc; SAXBuilder saxBuilder = new SAXBuilder(); try { doc = saxBuilder.build(is); } catch (JDOMException e) { throw new IOException(e.getMessage()); } read(doc.getRootElement(), errlog); }
public boolean populate(InputStream ncml, NetcdfFile target) throws IOException { org.jdom2.Document doc; try { SAXBuilder builder = new SAXBuilder(validate); doc = builder.build(ncml); } catch (JDOMException e) { throw new IOException(e.getMessage()); } if (showParsedXML) { XMLOutputter xmlOut = new XMLOutputter(); System.out.println("*** NetcdfDataset/showParsedXML = \n" + xmlOut.outputString(doc) + "\n*******"); } Element netcdfElem = doc.getRootElement(); readGroup(target, target.getRootGroup(), netcdfElem); return errlog.toString().length() == 0; }
public static void read(InputStream is, StringBuilder errlog) throws IOException { Document doc; SAXBuilder saxBuilder = new SAXBuilder(); try { doc = saxBuilder.build(is); } catch (JDOMException e) { throw new IOException(e.getMessage()); } read(doc.getRootElement(), errlog); }
public boolean populate(InputStream ncml, NetcdfFile target) throws IOException { org.jdom2.Document doc; try { SAXBuilder builder = new SAXBuilder(); doc = builder.build(ncml); } catch (JDOMException e) { throw new IOException(e.getMessage()); } if (showParsedXML) { XMLOutputter xmlOut = new XMLOutputter(); System.out.println("*** NetcdfDataset/showParsedXML = \n" + xmlOut.outputString(doc) + "\n*******"); } Element netcdfElem = doc.getRootElement(); readGroup(target, target.getRootGroup(), netcdfElem); return errlog.toString().length() == 0; }
public boolean populate(InputStream ncml, NetcdfFile target) throws IOException { org.jdom2.Document doc; try { SAXBuilder builder = new SAXBuilder(validate); doc = builder.build(ncml); } catch (JDOMException e) { throw new IOException(e.getMessage()); } if (showParsedXML) { XMLOutputter xmlOut = new XMLOutputter(); System.out.println("*** NetcdfDataset/showParsedXML = \n" + xmlOut.outputString(doc) + "\n*******"); } Element netcdfElem = doc.getRootElement(); readGroup(target, target.getRootGroup(), netcdfElem); return errlog.toString().length() == 0; }
public void readTable() throws IOException { org.jdom2.Document doc; try { SAXBuilder builder = new SAXBuilder(); doc = builder.build(robbxml); Element root = doc.getRootElement(); int count = makeTable(root.getChildren("sequence")); System.out.println(" robb count= "+count); } catch (JDOMException e) { throw new IOException(e.getMessage()); } }
public void readBmt() throws IOException { org.jdom2.Document doc; try { SAXBuilder builder = new SAXBuilder(); doc = builder.build(bmt); Element root = doc.getRootElement(); int count = makeBmtTable(root.getChildren("featureCatalogue")); System.out.println(" bmt count= "+count); /* Format pretty = Format.getPrettyFormat(); // wierd - cant pretty print ??!! XMLOutputter fmt = new XMLOutputter(pretty); //Writer pw = new FileWriter("C:/docs/bufr/wmo/wordNice.txt"); fmt.output(doc, new PrintWriter(System.out)); */ } catch (JDOMException e) { throw new IOException(e.getMessage()); } }
static public void passTwo() throws IOException { org.jdom2.Document tdoc; try { SAXBuilder builder = new SAXBuilder(); tdoc = builder.build(trans1); org.jdom2.Document ndoc = new org.jdom2.Document(); Element nroot = new Element("ndoc"); ndoc.setRootElement(nroot); transform2(tdoc.getRootElement(), nroot); XMLOutputter fmt = new XMLOutputter(Format.getPrettyFormat()); Writer pw = new FileWriter(trans2); fmt.output(ndoc, pw); pw = new PrintWriter(System.out); fmt.output(ndoc, pw); } catch (JDOMException e) { throw new IOException(e.getMessage()); } }