/** * Return a new DOM Document. */ public static Document getDocument() { return getDOMParser(false, false).newDocument(); }
/** * Read a collection of {@link ObjectData}s from the contents of the * given file. */ private Collection read(File f) throws Exception { // parse the file and return the objects it contains SAXParser parser = XMLFactory.getSAXParser(false, false); ObjectDataHandler handler = new ObjectDataHandler(_conf); parser.parse(f, handler); return handler.getExtent(); }
/** * Return a DocumentBuilder with the specified configuration. */ public static DocumentBuilder getDOMParser(boolean validating, boolean namespaceAware) { DocumentBuilder db; try { db = _domFactories[factoryIndex(validating, namespaceAware)]. newDocumentBuilder(); } catch (ParserConfigurationException pce) { throw new RuntimeException(pce); } if (validating) db.setErrorHandler(_validating); return db; }
/** * Return a new DOM Document. */ public static Document getDocument() { return getDOMParser(false, false).newDocument(); }
/** * Read a collection of {@link ObjectData}s from the contents of the * given file. */ private Collection read(File f) throws Exception { // parse the file and return the objects it contains SAXParser parser = XMLFactory.getSAXParser(false, false); ObjectDataHandler handler = new ObjectDataHandler(_conf); parser.parse(f, handler); return handler.getExtent(); }
/** * Return a DocumentBuilder with the specified configuration. */ public static DocumentBuilder getDOMParser(boolean validating, boolean namespaceAware) { DocumentBuilder db; try { db = _domFactories[factoryIndex(validating, namespaceAware)]. newDocumentBuilder(); } catch (ParserConfigurationException pce) { throw new RuntimeException(pce); } if (validating) db.setErrorHandler(_validating); return db; }
/** * Return a new DOM Document. */ public static Document getDocument() { return getDOMParser(false, false).newDocument(); }
SAXParser parser = XMLFactory.getSAXParser(validating, true); Object schema = null; if (validating) {
/** * Return a DocumentBuilder with the specified configuration. */ public static DocumentBuilder getDOMParser(boolean validating, boolean namespaceAware) { DocumentBuilder db; try { db = _domFactories[factoryIndex(validating, namespaceAware)]. newDocumentBuilder(); } catch (ParserConfigurationException pce) { throw new NestableRuntimeException(pce); } if (validating) db.setErrorHandler(_validating); return db; }
/** * Return a new DOM Document. */ public static Document getDocument() { return getDOMParser(false, false).newDocument(); }
parser = XMLFactory.getSAXParser(validating, true); Object schema = null; if (validating) {
/** * Return a DocumentBuilder with the specified configuration. */ public static DocumentBuilder getDOMParser(boolean validating, boolean namespaceAware) { DocumentBuilder db; try { db = _domFactories[factoryIndex(validating, namespaceAware)]. newDocumentBuilder(); } catch (ParserConfigurationException pce) { throw new NestableRuntimeException(pce); } if (validating) db.setErrorHandler(_validating); return db; }
public List<String> getDictionaries(InputStream in) { List<String> result = new ArrayList<String>(); DocumentBuilder builder = XMLFactory.getDOMParser(false, false); try { Document doc = builder.parse(in); Element root = doc.getDocumentElement(); NodeList nodes = root.getElementsByTagName("dictionary"); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); NamedNodeMap attrs = node.getAttributes(); Node dictionary = attrs.getNamedItem("class"); if (dictionary != null) { result.add(dictionary.getNodeValue()); } } } catch (Throwable e) { if (log.isWarnEnabled()) { log.error(_loc.get("error-code-parse-error")); } } finally { try { in.close(); } catch (IOException e) { // ignore } } return result; }
parser = XMLFactory.getSAXParser(validating, true); Object schema = null; if (validating) {
/** * Return a SAXParser with the specified configuration. */ public static SAXParser getSAXParser(boolean validating, boolean namespaceAware) { SAXParser sp; try { sp = _saxFactories[factoryIndex(validating, namespaceAware)]. newSAXParser(); } catch (ParserConfigurationException pce) { throw new RuntimeException(pce); } catch (SAXException se) { throw new RuntimeException(se); } if (validating) { try { sp.getXMLReader().setErrorHandler(_validating); } catch (SAXException se) { throw new RuntimeException(se); } } return sp; }
public List<String> getDictionaries(InputStream in) { List<String> result = new ArrayList<String>(); DocumentBuilder builder = XMLFactory.getDOMParser(false, false); try { Document doc = builder.parse(in); Element root = doc.getDocumentElement(); NodeList nodes = root.getElementsByTagName("dictionary"); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); NamedNodeMap attrs = node.getAttributes(); Node dictionary = attrs.getNamedItem("class"); if (dictionary != null) { result.add(dictionary.getNodeValue()); } } } catch (Throwable e) { if (log.isWarnEnabled()) { log.error(_loc.get("error-code-parse-error")); } } finally { try { in.close(); } catch (IOException e) { // ignore } } return result; }
parser = XMLFactory.getSAXParser(validating, true); Object schema = null; if (validating) {
/** * Return a SAXParser with the specified configuration. */ public static SAXParser getSAXParser(boolean validating, boolean namespaceAware) { SAXParser sp; try { sp = _saxFactories[factoryIndex(validating, namespaceAware)]. newSAXParser(); } catch (ParserConfigurationException pce) { throw new RuntimeException(pce); } catch (SAXException se) { throw new RuntimeException(se); } if (validating) { try { sp.getXMLReader().setErrorHandler(_validating); } catch (SAXException se) { throw new RuntimeException(se); } } return sp; }
public List<String> getDictionaries(InputStream in) { List<String> result = new ArrayList<String>(); DocumentBuilder builder = XMLFactory.getDOMParser(false, false); try { Document doc = builder.parse(in); Element root = doc.getDocumentElement(); NodeList nodes = root.getElementsByTagName("dictionary"); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); NamedNodeMap attrs = node.getAttributes(); Node dictionary = attrs.getNamedItem("class"); if (dictionary != null) { result.add(dictionary.getNodeValue()); } } } catch (Throwable e) { if (log.isWarnEnabled()) { log.error(_loc.get("error-code-parse-error")); } } finally { try { in.close(); } catch (IOException e) { // ignore } } return result; }
/** * Return a SAXParser with the specified configuration. */ public static SAXParser getSAXParser(boolean validating, boolean namespaceAware) { SAXParser sp; try { sp = _saxFactories[factoryIndex(validating, namespaceAware)]. newSAXParser(); } catch (ParserConfigurationException pce) { throw new NestableRuntimeException(pce); } catch (SAXException se) { throw new NestableRuntimeException(se); } if (validating) { try { sp.getXMLReader().setErrorHandler(_validating); } catch (SAXException se) { throw new NestableRuntimeException(se); } } return sp; }