/** * @see org.apache.excalibur.xml.dom.DOMParser#parseDocument(org.xml.sax.InputSource) */ public Document parseDocument(InputSource arg0) throws SAXException, IOException { return this.parser.parseDocument(arg0); } }
/** * Performs an XPath query on the source. * @param in the Source the XPath is performed on. * @throws SAXException if something goes wrong while adding the XML snippet. */ protected void performXPathQuery(TraversableSource in) throws SAXException { doc = null; try { doc = this.parser.parseDocument(SourceUtil.getInputSource(in)); } catch (SAXException se) { getLogger().error("Warning:" + in.getName() + " is not a valid XML document. Ignoring"); } catch (Exception e) { this.getLogger().error("Unable to resolve and parse document" + e); } if (doc != null) { NodeList nl = processor.selectNodeList(doc.getDocumentElement(), xpath, this.prefixResolver); final String id = in.getName(); AttributesImpl attributes = new AttributesImpl(); attributes.addAttribute("", RESULT_DOCID_ATTR, RESULT_DOCID_ATTR," CDATA", id); attributes.addAttribute("", QUERY_ATTR_NAME, QUERY_ATTR_NAME, "CDATA",xpath); super.contentHandler.startElement(URI, XPATH_NODE_NAME, PREFIX + ":" + XPATH_NODE_NAME, attributes); DOMStreamer ds = new DOMStreamer(super.xmlConsumer); for (int i = 0; i < nl.getLength(); i++) { ds.stream(nl.item(i)); } super.contentHandler.endElement(URI, XPATH_NODE_NAME, PREFIX + ":" + XPATH_NODE_NAME); } }
this.doc = this.parser.parseDocument(SourceUtil.getInputSource(source)); } catch (SAXException e) { getLogger().error("Warning:" + xmlFile.getName() + " is not a valid XML file. Ignoring.", e);