Package org.jdom.output

Examples of org.jdom.output.SAXOutputter


        try {
            Verifier verifier = this.newVerifier();
            verifier.setErrorHandler(errorHandler);

            errorHandler.setContentHandler(verifier.getVerifierHandler());
            new SAXOutputter(errorHandler).output(doc);
        }
        catch (SAXException e) { /* Fatal validation error encountered. */
        }

        // Retrieve validation errors, if any.
View Full Code Here


            List nodes = new ArrayList();
            nodes.add(element);

            errorHandler.setContentHandler(verifier.getVerifierHandler());
            new SAXOutputter(errorHandler).output(nodes);
        }
        catch (SAXException e) { /* Fatal validation error encountered. */
        }

        // Retrieve validation errors, if any.
View Full Code Here

        // create an XPathTracker
        XPathTracker tracker = new XPathTracker(document.getRootElement());

        // create a SAXOutputter
        SAXOutputter outputter = new SAXOutputter();
        // Set the ContentHandler of the outputter to an instance of
        // the XPathTrakerFeeder class. The XPathTrackerFeeder class
        // ensures that the tracker receives all startElement and endElement
        // events. In addition, it also checks that the trackers current
        // xpath matches an expected xpath.
        outputter.setContentHandler(new XPathTrackerFeeder(tracker));
        // output the document
        outputter.output(document);

    }
View Full Code Here

      if (sd.size () == 0) {
    return org.w3c.dom.Element.class;
      }
      SAXEventBufferImpl seb = new SAXEventBufferImpl ();
      try {
    (new SAXOutputter (seb)).output (sd);
      } catch (JDOMException e) {
    new IllegalArgumentException ("Cannot convert schema to SAX: "
                + e.getMessage ());
      }
      seb.pack();
View Full Code Here

     * @throws ImportException if the XPDL is not correct.
     */
    public DefaultProcessDefinition (Document processDefinition)
  throws JDOMException, ImportException {
  try {
      SAXOutputter outputter = new SAXOutputter();
      procDef = new SAXEventBufferImpl ();
      outputter.setContentHandler(procDef);
      outputter.setLexicalHandler(procDef);
      outputter.output (processDefinition);
  } catch (JDOMException e) {
      String s = "Cannot get XPDL from DOM: " + e.getMessage();
      logger.error (s, e);
      throw new IllegalArgumentException (s);
  }
View Full Code Here

    }

    private void subtreeToSAX (Element e, ContentHandler h) {
  try {
      SAXEventBufferImpl buf = new SAXEventBufferImpl ();
      SAXOutputter out = new SAXOutputter (buf);
      out.output(new Document((Element)e.clone()));
      HandlerStack hs = new HandlerStack (h);
      buf.emit (hs.contentHandler());
  } catch (JDOMException ex) {
      throw new IllegalArgumentException (ex.getMessage ());
  } catch (SAXException ex) {
View Full Code Here

    try {
        if (logger.isDebugEnabled ()) {
      logger.debug
          ("Convering item " + name + " from JDOM to SAX");
        }
        SAXOutputter outputter = new SAXOutputter();
        SAXEventBufferImpl b = new SAXEventBufferImpl ();
        outputter.setContentHandler(b);
        outputter.setLexicalHandler(b);
        if (v instanceof Document) {
      outputter.output ((Document)v);
        } else {
      List l;
      if (v instanceof List) {
          l = (List)v;
      } else {
          l = new ArrayList ();
          l.add (v);
      }
      outputter.output (l);
        }
        b.pack();
        v = b;
        newValues.put (name, v);
    } catch (JDOMException e) {
View Full Code Here

            }
        }

        public XMLStreamReader getReader() throws XMLStreamException {
            SAXOMBuilder builder = new SAXOMBuilder();
            SAXOutputter outputter = new SAXOutputter();
            outputter.setContentHandler(builder);
            outputter.setEntityResolver(builder);
            outputter.setDTDHandler(builder);
            outputter.setEntityResolver(builder);
            return builder.getRootElement().getXMLStreamReader();
        }
View Full Code Here

            }
        }

        public XMLStreamReader getReader() throws XMLStreamException {
            SAXOMBuilder builder = new SAXOMBuilder();
            SAXOutputter outputter = new SAXOutputter();
            outputter.setContentHandler(builder);
            outputter.setEntityResolver(builder);
            outputter.setDTDHandler(builder);
            outputter.setEntityResolver(builder);
            return builder.getRootElement().getXMLStreamReader();
        }
View Full Code Here

            "Error translating HTML fragment into DRI", t);
      }

      SAXFilter filter = new SAXFilter(contentHandler, lexicalHandler,
          namespaces);
      SAXOutputter outputter = new SAXOutputter();
      outputter.setContentHandler(filter);
      outputter.setLexicalHandler(filter);

      Element root = document.getRootElement();

      @SuppressWarnings("unchecked")
      // This cast is correct
      List<Element> children = root.getChildren();
      for (Element child : children) {
        outputter.output(child);
      }

    } catch (JDOMException e) {
                        //If we are here, then a parsing error occurred within the XHTML fragment.  We'll just assume
                        // that this is not supposed to be XHTML and display the fragment as plain text within <dri:p> tags.
View Full Code Here

TOP

Related Classes of org.jdom.output.SAXOutputter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.