Package org.jdom.transform

Examples of org.jdom.transform.JDOMResult$DocumentBuilder


    protected XMLDocument createXSQLDocument(MessageExchange exchange, NormalizedMessage in) throws MessagingException {
        if (xsql != null) {
            return xsql;
        }
        try {
            DocumentBuilder builder = new DocumentBuilder();
            SAXResult result = new SAXResult(builder);
            sourceTransformer.toResult(in.getContent(), result);
            return builder.getDocument();
        }
        catch (TransformerException e) {
            throw new MessagingException("Failed to convert inbound message content to an XMLDocument. Reason: " + e, e);
        }
    }
View Full Code Here


        Document doc = new Document((Element) element.clone());

      Transformer transformer = TransformerFactory.newInstance().newTransformer(new StreamSource(Options.getXSLT()));
        //Transformer transformer = TransformerFactory.newInstance().newTransformer(new StreamSource(getXSLT()));
        JDOMSource in = new JDOMSource(doc);
        JDOMResult out = new JDOMResult();
        transformer.transform(in, out);

        List result = out.getResult();

        tmp = File.createTempFile(Options.getXSLTFilePrefix(), Options.getXSLTFileSuffix());
       
        tmp.deleteOnExit();
View Full Code Here

  public Document transform(String xslt, Document input) throws FitsToolException {
    Document doc = null;
    try {
      Configuration config = ((TransformerFactoryImpl)tFactory).getConfiguration();
      DocumentWrapper docw = new DocumentWrapper(input,null,config);
      JDOMResult out = new JDOMResult();
      Templates templates = tFactory.newTemplates(new StreamSource(xslt));
      Transformer transformer = templates.newTransformer();
      transformer.transform(docw, out);
      doc = out.getDocument();
    }
    catch(Exception e) {
      throw new FitsToolException(info.getName()+": Error converting output using "+xslt,e);
    }
    return doc;
View Full Code Here

                    } else {
                        throw new XFireFault("Unkown Error", XFireFault.RECEIVER);
                    }
                } else if (me.getStatus() == ExchangeStatus.ACTIVE) {
                    if (me.getFault() != null) {
                        JDOMResult result = new JDOMResult();
                        String str = getTransformer().contentToString(me.getFault());
                        getTransformer().toResult(new StringSource(str), result);
                        Element e = result.getDocument().getRootElement();
                        e = (Element) e.clone();
                        me.setStatus(ExchangeStatus.DONE);
                        channel.send(me);
                        XFireFault xfireFault = new XFireFault(str, XFireFault.RECEIVER);
                        xfireFault.getDetail().addContent(e);
View Full Code Here

    StreamSource streamSrc = new StreamSource(xsltFile);
    TransformerFactory tFactory = TransformerFactory.newInstance();

    try {
      Transformer transformer = tFactory.newTransformer(streamSrc);
      JDOMResult jdomRes = new JDOMResult();
      JDOMSource jdomSrc = new JDOMSource(inputXML);
      transformer.transform(jdomSrc, jdomRes);

      outputXML = jdomRes.getDocument();
    }
    catch(TransformerConfigurationException e) {
      e.printStackTrace();
      System.exit(0);
    }
View Full Code Here

                    } else {
                        throw new XFireFault("Unkown Error", XFireFault.RECEIVER);
                    }
                } else if (me.getStatus() == ExchangeStatus.ACTIVE) {
                    if (me.getFault() != null) {
                        JDOMResult result = new JDOMResult();
                        String str = getTransformer().contentToString(me.getFault());
                        getTransformer().toResult(new StringSource(str), result);
                        Element e = result.getDocument().getRootElement();
                        e = (Element) e.clone();
                        me.setStatus(ExchangeStatus.DONE);
                        channel.send(me);
                        XFireFault xfireFault = new XFireFault(str, XFireFault.RECEIVER);
                        xfireFault.getDetail().addContent(e);
View Full Code Here

public class XSLTransformer extends SimpleProcessor implements ConfigurableProcessor {
    private Transformer transformer;

    public Value process(Value input, Context context) throws Exception {
      Document document = ((DocumentValue)input).getDocument();
        JDOMResult result = new JDOMResult();
        transformer.transform(new JDOMSource(document), result);
        return new DocumentValue(result.getDocument());
    }
View Full Code Here

   * @return a {@link Document} object.
   */
  @NotNull
  public static Document toJDom( @NotNull org.w3c.dom.Document document ) {
    try {
      JDOMResult target = new JDOMResult();
      TransformerFactory.newInstance().newTransformer().transform( new DOMSource( document ), target );
      return target.getDocument();
    } catch ( TransformerException e ) {
      throw new RuntimeException( e );
    }
  }
View Full Code Here

  }

  @NotNull
  public static Document toJDom( @NotNull org.w3c.dom.Document document ) {
    try {
      JDOMResult target = new JDOMResult();
      TransformerFactory.newInstance().newTransformer().transform( new DOMSource( document ), target );
      return target.getDocument();
    } catch ( TransformerException e ) {
      throw new RuntimeException( e );
    }
  }
View Full Code Here

     * @return
     * @throws Exception
     */
  public static Element transform(Element xml, String styleSheetPath) throws Exception
  {
    JDOMResult resXml = new JDOMResult();
    transform(xml, styleSheetPath, resXml, null);
    return (Element)resXml.getDocument().getRootElement().detach();
  }
View Full Code Here

TOP

Related Classes of org.jdom.transform.JDOMResult$DocumentBuilder

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.