Examples of JAXBResult


Examples of javax.xml.bind.util.JAXBResult

        return new JAXBBridgeSource(bridge,jaxbObject);
    }

    @Override
    public <T> T readPayloadAsJAXB(Unmarshaller unmarshaller) throws JAXBException {
        JAXBResult out = new JAXBResult(unmarshaller);
        // since the bridge only produces fragments, we need to fire start/end document.
        try {
            out.getHandler().startDocument();
            if (rawContext != null) {
              Marshaller m = rawContext.createMarshaller();
              m.setProperty("jaxb.fragment", Boolean.TRUE);
              m.marshal(jaxbObject,out);
            } else
              bridge.marshal(jaxbObject,out);
            out.getHandler().endDocument();
        } catch (SAXException e) {
            throw new JAXBException(e);
        }
        return (T)out.getResult();
    }
View Full Code Here

Examples of javax.xml.bind.util.JAXBResult

                parameters.put("all", quantifier == ALL);
                if (quantifier == NAMED)
                        parameters.put("types", ArrayUtils.toString(keys));

                final Document partDOM = marshaltoW3CDomDocument(part.getJaxbElement());
                final JAXBResult result = prepareJAXBResult(Context.jc);

                transform(partDOM, removalTemplate, parameters, result);

                try {
                        part.setJaxbElement(result);
View Full Code Here

Examples of javax.xml.bind.util.JAXBResult

   
    // Finally, apply pictureLayoutTree2DiagramDataXslt to create DiagramData part
           
//    ByteArrayOutputStream layoutBAOS3 = new ByteArrayOutputStream();
//    Result result = new StreamResult(layoutBAOS3);
    JAXBResult result = new JAXBResult(Context.jc );   
    java.util.HashMap<String, Object> settings = new java.util.HashMap<String, Object>();
   
    settings.put("list", xml);
    settings.put("DiagramDataPart", data);
    XmlUtils.transform(
        new javax.xml.transform.stream.StreamSource(
            new java.io.StringReader(tmpXslStr)),
            layoutTree2DiagramDataXslt, settings, result);   
   
    // What did we generate
//    tmpXslStr = layoutBAOS3.toString("UTF-8");
//    System.out.println(tmpXslStr);

    // Finally, inject this into your DiagramData part
    // .. first, we need to make the IDs Word friendly.
    Object ddJaxb = result.getResult();
    DiagramDataPart.setFriendlyIds(XmlUtils.unwrap(ddJaxb));
   
    //System.out.println(XmlUtils.marshaltoString(ddJaxb, false));
    return (CTDataModel)XmlUtils.unwrap(ddJaxb);
       
View Full Code Here

Examples of javax.xml.bind.util.JAXBResult

          eventHandler.setContinue(true);
                   
          try {
            Templates mcPreprocessorXslt = JaxbValidationEventHandler.getMcPreprocessor();
            is.reset();
            JAXBResult result = XmlUtils.prepareJAXBResult(jc);
            XmlUtils.transform(new StreamSource(is),
                mcPreprocessorXslt, null, result);
            jaxbElement = (E) XmlUtils.unwrap(
                result.getResult() )
          } catch (Exception e) {
            throw new JAXBException("Preprocessing exception", e);
          }
                     
        } else {
View Full Code Here

Examples of javax.xml.bind.util.JAXBResult

      return;
    }
           
//    ByteArrayOutputStream layoutBAOS3 = new ByteArrayOutputStream();
//    Result result = new StreamResult(layoutBAOS3);
    JAXBResult result = new JAXBResult(Context.jc );   
    java.util.HashMap<String, Object> settings = new java.util.HashMap<String, Object>();
   
    settings.put("list", doc);
    XmlUtils.transform(
        new javax.xml.transform.stream.StreamSource(
            new java.io.StringReader(tmpXslStr)),
            xsltLT2DD, settings, result);   
   
    // What did we generate
//    tmpXslStr = layoutBAOS3.toString("UTF-8");
//    System.out.println(tmpXslStr);

    // Finally, inject this into your DiagramData part
    // .. first, we need to make the IDs Word friendly.
    Object ddJaxb = result.getResult();
    DiagramDataPart.setFriendlyIds(XmlUtils.unwrap(ddJaxb));
   
    System.out.println(XmlUtils.marshaltoString(ddJaxb, false));
 
View Full Code Here

Examples of javax.xml.bind.util.JAXBResult

            // being used on something deep in the tree?
            // TODO: revisit
            doc = el.getOwnerDocument();
          }
          eventHandler.setContinue(true);
          JAXBResult result = XmlUtils.prepareJAXBResult(jc);
          Templates mcPreprocessorXslt = JaxbValidationEventHandler
              .getMcPreprocessor();
          XmlUtils.transform(doc, mcPreprocessorXslt, null, result);
          jaxbElement = (E) XmlUtils.unwrap(
              result.getResult() )
        } catch (Exception e) {
          throw new JAXBException("Preprocessing exception", e);
        }
      }
      return jaxbElement;
View Full Code Here

Examples of javax.xml.bind.util.JAXBResult

 

  public Word2003XmlConverter(Source source) throws JAXBException, Docx4JException {
   
    // Use 2003-import.xsl to convert to a Transition03To06 object
    JAXBResult result = new JAXBResult(
             JAXBContext.newInstance("org.docx4j.convert.in.word2003xml") );
    XmlUtils.transform(source, xslt, null, result);
   
    // set the unmarshalled content tree
    transitionContainer = (Transition03To06)result.getResult();
  }
View Full Code Here

Examples of javax.xml.bind.util.JAXBResult

    public Source readPayloadAsSource() {
        return new JAXBBridgeSource(bridge,jaxbObject);
    }

    public <T> T readPayloadAsJAXB(Unmarshaller unmarshaller) throws JAXBException {
        JAXBResult out = new JAXBResult(unmarshaller);
        // since the bridge only produces fragments, we need to fire start/end document.
        try {
            out.getHandler().startDocument();
            bridge.marshal(jaxbObject,out);
            out.getHandler().endDocument();
        } catch (SAXException e) {
            throw new JAXBException(e);
        }
        return (T)out.getResult();
    }
View Full Code Here

Examples of javax.xml.bind.util.JAXBResult

        }
    }

    public <T> T readAsJAXB(Unmarshaller unmarshaller) throws JAXBException {
        try {
            JAXBResult r = new JAXBResult(unmarshaller);
            // bridge marshals a fragment, so we need to add start/endDocument by ourselves
            r.getHandler().startDocument();
            bridge.marshal(jaxbObject,r);
            r.getHandler().endDocument();
            return (T)r.getResult();
        } catch (SAXException e) {
            throw new JAXBException(e);
        }
    }
View Full Code Here

Examples of javax.xml.bind.util.JAXBResult

    public Source readPayloadAsSource() {
        return new JAXBBridgeSource(bridge,jaxbObject);
    }

    public <T> T readPayloadAsJAXB(Unmarshaller unmarshaller) throws JAXBException {
        JAXBResult out = new JAXBResult(unmarshaller);
        // since the bridge only produces fragments, we need to fire start/end document.
        try {
            out.getHandler().startDocument();
            bridge.marshal(jaxbObject,out);
            out.getHandler().endDocument();
        } catch (SAXException e) {
            throw new JAXBException(e);
        }
        return (T)out.getResult();
    }
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.