Examples of SAXHandler


Examples of org.jdom.input.SAXHandler

    ("actParamTests", "jelly-test1", cont);
      process.start();
      assertTrue (stateReached (process, "closed.completed"));
      SAXEventBuffer res = (SAXEventBuffer)
    process.processContext().get ("result");
      SAXHandler sh = new SAXHandler ();
      res.emit (sh);
      Document resDoc = sh.getDocument();
      XPath xpath = new JDOMXPath("/result/inserted/root/element1/@attr1");
      String val = xpath.stringValueOf(resDoc);
      assertTrue ("Value is: " + val, val.equals ("42"));
      xpath = new JDOMXPath("/result/test");
      val = xpath.stringValueOf(resDoc);
View Full Code Here

Examples of org.jdom.input.SAXHandler

    ("jelly-test", "jelly-test1", cont);
      process.start();
      assertTrue (stateReached (process, "closed.completed"));
      SAXEventBuffer res = (SAXEventBuffer)
    process.processContext().get ("result");
      SAXHandler sh = new SAXHandler ();
      res.emit (sh);
      Document resDoc = sh.getDocument();
      XPath xpath = new JDOMXPath("/result/inserted/root/element1/@attr1");
      String val = xpath.stringValueOf(resDoc);
      assertTrue ("Value is: " + val, val.equals ("42"));
      xpath = new JDOMXPath("/result/test");
      val = xpath.stringValueOf(resDoc);
View Full Code Here

Examples of org.jdom.input.SAXHandler

     *
     * @return the process definition presented as JDOM document.
     */
    public Document toJDOM () {
  try {
      SAXHandler sh = new SAXHandler ();
      procDef.emit(sh, sh);
      return sh.getDocument();
  } catch (SAXException e) {
      logger.error (e.getMessage(), e);
      throw new IllegalStateException
    ("Error generating XPDL as JDOM: " + e.getMessage());
  }
View Full Code Here

Examples of org.jdom.input.SAXHandler

      // if value is XML, try converting to JDOM
      try {
          Class[] argTypes = { Element.class };
          method = appClass.getMethod
        ("set" + param, argTypes);
          SAXHandler sh = new SAXHandler ();
          ((SAXEventBufferImpl)value).emit(sh, sh);
          args[0] = sh.getDocument().getRootElement();
      } catch (NoSuchMethodException eee) {
          // finally try converting to W3C DOM
          Class[] argTypes
        = { org.w3c.dom.Element.class };
          method = appClass.getMethod
View Full Code Here

Examples of org.jdom.input.SAXHandler

      for (Iterator i = params.keySet().iterator(); i.hasNext();) {
    String pn = (String)i.next();
    Object v = params.get (pn);
    if (v instanceof SAXEventBuffer) {
        try {
      SAXHandler sh = new SAXHandler ();
      convertWithTempRoot(sh, (SAXEventBuffer)v);
      Element temporaryRoot
          = sh.getDocument().getRootElement();
      params.put (pn, temporaryRoot.getChildren());
        } catch (SAXException e) {
      logger.error (e.getMessage(), e);
      throw new ToolInvocationException (e.getMessage());
        }
View Full Code Here

Examples of org.jdom.input.SAXHandler

  for (Iterator it = map.keySet().iterator(); it.hasNext();) {
      String name = (String) it.next();
      if (name.equals("complexResult")) {
    SAXEventBufferImpl myBuffer
        = (SAXEventBufferImpl)map.get(name);
    SAXHandler sh = new SAXHandler ();
    sh.startDocument();
    sh.startElement
        ("", "temporary-root", "temporary-root", new AttributesImpl());
    myBuffer.emit(sh, (LexicalHandler)sh);
    sh.endElement ("", "temporary-root", "temporary-root");
    sh.endDocument();
    org.jdom.Element temporaryRoot = sh.getDocument().getRootElement();
    XPath xpath = new JDOMXPath("/temporary-root/row[2]");
    org.jdom.Element painter
        = (org.jdom.Element)xpath.selectSingleNode(temporaryRoot);
    String value = painter.getAttribute("title").getValue();
    // check testXSLT.xml for the expected result
View Full Code Here

Examples of org.jdom.input.SAXHandler

  private void parseAndValidate(InputStream inputStream) throws IOException,
      SAXException, SAXNotRecognizedException, SAXNotSupportedException {
    assertNotNull(inputStream);
    UNEdifactInterchangeParser parser = new UNEdifactInterchangeParser();
    parser.setFeature(EDIParser.FEATURE_IGNORE_NEWLINES, true);
    SAXHandler handler = new SAXHandler();
    parser.setContentHandler(handler);
    parser.parse(new InputSource(inputStream));
    Document doc = handler.getDocument();
    // Here you have your document
    StringWriter xmlWriter = new StringWriter();
    new XMLOutputter(Format.getPrettyFormat()).output(doc, xmlWriter);
    String xml = xmlWriter.getBuffer().toString();
    XMLReader reader = EDIParsingUtils.createValidatingReader();
View Full Code Here

Examples of org.jdom2.input.sax.SAXHandler

        try {
            final JDOMFactory jdomFac = new ArdorFactory(dataCache);
            final SAXBuilder builder = new SAXBuilder(null, new SAXHandlerFactory() {
                @Override
                public SAXHandler createSAXHandler(final JDOMFactory factory) {
                    return new SAXHandler(jdomFac) {
                        @Override
                        public void startPrefixMapping(final String prefix, final String uri) throws SAXException {
                            // Just kill what's usually done here...
                        }
                    };
View Full Code Here

Examples of org.jdom2.input.sax.SAXHandler

   *         if there is any problem initialising the engine.
   */
  public SAXEngine buildEngine() throws JDOMException {

    // Create and configure the content handler.
    final SAXHandler contentHandler = handlerfac.createSAXHandler(jdomfac);

    contentHandler.setExpandEntities(expand);
    contentHandler.setIgnoringElementContentWhitespace(ignoringWhite);
    contentHandler.setIgnoringBoundaryWhitespace(ignoringBoundaryWhite);

    final XMLReader parser = createParser();
    // Configure parser
    configureParser(parser, contentHandler);
    final boolean valid = readerfac.isValidating();
View Full Code Here

Examples of org.milyn.delivery.sax.SAXHandler

        if(parentContentHandler.getNestedContentHandler() != null) {
            throw new SmooksException("Illegal use of more than one nested content handler fired on the same element.");
        }

        SmooksContentHandler nestedContentHandler = new SAXHandler(nestedExecutionContext, element.getWriter(this), parentContentHandler);

        DynamicSAXElementVisitorList.propogateDynamicVisitors(executionContext, nestedExecutionContext);

        // Attach the XMLReader instance to the nested ExecutionContext and then swap the content handler on
        // the XMLReader to be the nested handler created here.  All events wll be forwarded to the ..
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.