/** * This will output the <code>JDOM Document</code>, firing off the SAX * events that have been registered. * * @param document * <code>JDOM Document</code> to output. * @throws JDOMException * if any error occurred. */ public void output(Document document) throws JDOMException { processor.process(buildTarget(document), format, document); }
/** * This will look up the value of a SAX property. * * @param name * <code>String</code> the property name, which is a fully-qualified * URI. * @return <code>Object</code> the current value of the property. * @throws SAXNotRecognizedException * when SAXOutputter does not recognize the property name. * @throws SAXNotSupportedException * when SAXOutputter recognizes the property name but cannot * determine its value at this time. */ public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException { if ((SAX_PROPERTY_LEXICAL_HANDLER.equals(name)) || (SAX_PROPERTY_LEXICAL_HANDLER_ALT.equals(name))) { return this.getLexicalHandler(); } if ((SAX_PROPERTY_DECLARATION_HANDLER.equals(name)) || (SAX_PROPERTY_DECLARATION_HANDLER_ALT.equals(name))) { return this.getDeclHandler(); } throw new SAXNotRecognizedException(name); }
if ((SAX_PROPERTY_LEXICAL_HANDLER.equals(name)) || (SAX_PROPERTY_LEXICAL_HANDLER_ALT.equals(name))) { this.setLexicalHandler((LexicalHandler) value); } else { if ((SAX_PROPERTY_DECLARATION_HANDLER.equals(name)) || (SAX_PROPERTY_DECLARATION_HANDLER_ALT.equals(name))) { this.setDeclHandler((DeclHandler) value); } else { throw new SAXNotRecognizedException(name);
if (SAX_FEATURE_NAMESPACE_PREFIXES.equals(name)) { this.setReportNamespaceDeclarations(value); } else { if (SAX_FEATURE_NAMESPACES.equals(name)) { if (SAX_FEATURE_VALIDATION.equals(name)) { this.setReportDTDEvents(value); } else {
public void provideSAXEvents(ContentHandler handler) throws SAXException { try { SAXOutputter output = new SAXOutputter(handler); output.output(doc); } catch (JDOMException ex) { throw new SAXException(ex); } }
public JDomDocumentToStream(final XmlPipe<StreamReceiver> xmlPipe) { this.xmlPipe = xmlPipe; saxOutputer = new SAXOutputter(xmlPipe); }
@Override public void process(final Document document) { assert null!=document; try { saxOutputer.output(document); } catch (JDOMException e) { throw new IllegalArgumentException("Invalid JDOM document", e); } }
SAXTarget out = buildTarget(null); break; default: handleError(new JDOMException("Invalid element content: " + node));
final SAXOutputter outputter = new SAXOutputter(unmarshaller); outputter.output(document); outputter.output(element);
/** * This will output a single JDOM element as a document, firing off the SAX * events that have been registered. * * @param node * the <code>Element</code> node to output. * @throws JDOMException * if any error occurred. */ public void output(Element node) throws JDOMException { processor.processAsDocument(buildTarget(null), format, node); }
/** * This will output a list of JDOM nodes as a document, firing off the SAX * events that have been registered. * <p> * <strong>Warning</strong>: This method may output ill-formed XML documents * if the list contains top-level objects that are not legal at the document * level (e.g. Text or CDATA nodes, multiple Element nodes, etc.). Thus, it * should only be used to output document portions towards ContentHandlers * capable of accepting such ill-formed documents (such as XSLT processors). * </p> * * @param nodes * <code>List</code> of JDOM nodes to output. * @throws JDOMException * if any error occurred. * @see #output(org.jdom2.Document) */ public void output(List<? extends Content> nodes) throws JDOMException { processor.processAsDocument(buildTarget(null), format, nodes); }
/** * This will output a list of JDOM nodes as a fragment of an XML document, * firing off the SAX events that have been registered. * <p> * <strong>Warning</strong>: This method does not call the * {@link ContentHandler#setDocumentLocator}, * {@link ContentHandler#startDocument} and * {@link ContentHandler#endDocument} callbacks on the * {@link #setContentHandler ContentHandler}. The user shall invoke these * methods directly prior/after outputting the document fragments. * </p> * * @param nodes * <code>List</code> of JDOM nodes to output. * @throws JDOMException * if any error occurred. * @see #outputFragment(org.jdom2.Content) */ public void outputFragment(List<? extends Content> nodes) throws JDOMException { if (nodes == null) { return; } processor.process(buildTarget(null), format, nodes); }