List of usage examples for javax.xml.parsers ParserConfigurationException getMessage
public String getMessage()
From source file:Main.java
/** * Create a new DOM document//from www. j a va 2 s. co m */ public static Document newDocument() throws IOException { try { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); return builder.newDocument(); } catch (ParserConfigurationException e) { throw new IOException(e.getMessage()); } }
From source file:Main.java
/** * Load a DOM document/*from ww w.ja v a 2s . c o m*/ */ public static Document loadDocument(InputStream in) throws IOException { try { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); return builder.parse(in); } catch (ParserConfigurationException e) { throw new IOException(e.getMessage()); } catch (SAXException e) { throw new IOException(e.getMessage()); } }
From source file:Main.java
public static Document newDocument() throws IOException { try {//from www. j a v a 2s .co m return DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); } catch (ParserConfigurationException e) { throw new IOException(e.getMessage(), e); } }
From source file:Main.java
/** * @return New XML document from the default document builder factory. *///from w w w .j av a 2 s .c o m private static Document createDocument() { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder; try { builder = factory.newDocumentBuilder(); } catch (ParserConfigurationException e) { throw new RuntimeException(e.getMessage(), e); } return builder.newDocument(); }
From source file:Main.java
public static Document load(InputStream data) throws SAXException, IOException { try {//from w w w . j av a2 s .co m return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(data); } catch (ParserConfigurationException e) { throw new IOException(e.getMessage(), e); } }
From source file:Main.java
/** * Creates a new Document using the default XML implementation * /*w w w.j ava 2s .co m*/ * @return DOM */ public static Document newDocument() { try { return factory.newDocumentBuilder().newDocument(); } catch (ParserConfigurationException e) { throw new RuntimeException(e.getMessage(), e); } }
From source file:Main.java
public static Document parseXML(InputStream in) throws IOException, SAXException { Document doc = null;/*w w w . j a va 2 s. c om*/ try { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); doc = builder.parse(in); } catch (ParserConfigurationException e) { throw new IOException(e.getMessage()); } catch (FactoryConfigurationError e) { throw new IOException(e.getMessage()); } return doc; }
From source file:Main.java
public static Document CreateCustomerFile(JFrame mainFrame) { Document CustomerDoc = null;// w w w .j a va2 s . com try { DocumentBuilderFactory Factory = DocumentBuilderFactory.newInstance(); DocumentBuilder Build = Factory.newDocumentBuilder(); CustomerDoc = Build.newDocument(); Element rootElem = CustomerDoc.createElement("Customers"); CustomerDoc.appendChild(rootElem); } catch (ParserConfigurationException ex) { System.out.println(ex.getMessage()); JOptionPane.showMessageDialog(mainFrame, "There Was an Error Saving The File. Please Restart the Application."); System.exit(1); } return CustomerDoc; }
From source file:Main.java
public static synchronized DocumentBuilder getJaxpDocBuilderNNS() throws ParserConfigurationException { try {/*w w w . jav a2s. c om*/ System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"); System.setProperty("javax.xml.parsers.SaxParserFactory", "org.apache.xerces.jaxp.SAXParserFactoryImpl"); DocumentBuilderFactory docBuildFactory = DocumentBuilderFactory.newInstance(); docBuildFactory.setAttribute("http://apache.org/xml/features/dom/defer-node-expansion", new Boolean(false)); docBuildFactory.setNamespaceAware(false); docBuildFactory.setValidating(false); return docBuildFactory.newDocumentBuilder(); } catch (ParserConfigurationException pce) { throw new RuntimeException(pce.getMessage()); } }
From source file:Main.java
public static DocumentBuilder getJaxpDocBuilder() { try {/* ww w . j a v a2 s . c om*/ synchronized (jaxpLock) { System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"); System.setProperty("javax.xml.parsers.SaxParserFactory", "org.apache.xerces.jaxp.SAXParserFactoryImpl"); DocumentBuilderFactory docBuildFactory = DocumentBuilderFactory.newInstance(); docBuildFactory.setAttribute("http://apache.org/xml/features/dom/defer-node-expansion", Boolean.FALSE); docBuildFactory.setNamespaceAware(true); docBuildFactory.setValidating(false); return docBuildFactory.newDocumentBuilder(); } } catch (ParserConfigurationException pce) { throw new RuntimeException(pce.getMessage()); } }