Package javax.xml.transform

Examples of javax.xml.transform.Source


     * @return An InputSource with the loaded document
     */
    public InputSource loadSource(String href, String context, XSLTC xsltc) {
  try {
      // A _uriResolver must be set if this method is called
      final Source source = _uriResolver.resolve(href, context);
      if (source != null) {
    return Util.getInputSource(xsltc, source);
      }
  }
  catch (TransformerException e) {
View Full Code Here


   {
      JAXBContext ctx = JAXBContext.newInstance(CTX_CLASS);
      Unmarshaller um = ctx.createUnmarshaller();
      StringReader r = new StringReader(content);
      InputSource is = new InputSource(r);
      Source s = new SAXSource(is);
      JAXBElement<ManagedConnectionFactoryDeploymentGroup> elem = um.unmarshal(s, ManagedConnectionFactoryDeploymentGroup.class);
      ManagedConnectionFactoryDeploymentGroup group = elem.getValue();
      return group;
   }
View Full Code Here

    {
      SVGCanvasProvider provider = new SVGCanvasProvider(false, orientation);
      barcode.generateBarcode(provider, message);
      Document svgDoc = provider.getDOM();

      Source source = new DOMSource(svgDoc);
      StringWriter outWriter = new StringWriter();
      Result output = new StreamResult(outWriter);
      Transformer transformer = TransformerFactory.newInstance()
          .newTransformer();
      transformer.transform(source, output);
View Full Code Here

  
   private String getDocumentAsString(Document doc){
     
      try
      {
         final Source source = new DOMSource(doc);
         final StringWriter writer = new StringWriter();
         final StreamResult result = new StreamResult(writer);
         TransformerFactory.newInstance().newTransformer().transform(source, result);
         return writer.toString();
      }
View Full Code Here

    */
   private void outputXmlFile(Document doc, File file)
      throws Exception
   {
      // Prepare the DOM document for writing
      Source source = new DOMSource(doc);   
     
      // Use an OutputStream rather than a File
      OutputStream out = new FileOutputStream(file);
     
      // Prepare the output
View Full Code Here

            File dataFile  = new File(args[2])// data
            try {
                InputStream dataStream = new FileInputStream(dataFile);
                InputStream styleStream = new FileInputStream(styleFile);
                // create XSLT Source and Result objects
                Source data = new StreamSource(dataStream);
                Source style = new StreamSource(styleStream);
                Result output = new StreamResult(System.out);
                // create Transformer and perform the tranfomation
                Transformer xslt =  TransformerFactory.newInstance().newTransformer(style);
                xslt.transform(data, output);
            }
View Full Code Here

   * @return the unmarshalled JAXB object
   * @throws JAXBException when an error occurs
   */
  protected javax.xml.bind.Element unmarshal(org.dom4j.Element element)
      throws JAXBException {
    Source source = new StreamSource(new StringReader(element.asXML()));

    return (javax.xml.bind.Element) getUnmarshaller().unmarshal(source);
  }
View Full Code Here

    this.uriResolver = uriResolver;
    this.cacheStyleSheet(file);
  }

  private void cacheStyleSheet(File f) throws TransformerConfigurationException{
    Source xsltSource = new StreamSource(f);
    TransformerFactory transFact = TransformerFactory.newInstance();

    if(uriResolver != null){
      transFact.setURIResolver(uriResolver);
    }
View Full Code Here

    this.cacheStyleSheet(this.resourceClass,this.path);
  }

  private void cacheStyleSheet(Class<?> resourceClass, String path) throws TransformerConfigurationException{
    InputStream inputStream = resourceClass.getResourceAsStream(path);
    Source xsltSource = new StreamSource(inputStream);
    TransformerFactory transFact = TransformerFactory.newInstance();
    Templates templates = transFact.newTemplates(xsltSource);

    try {inputStream.close();} catch (IOException e) {}
View Full Code Here

    return namespaceAwareDocumentBuilder.newDocument();
  }

  public static String toString(Document doc, String encoding, boolean indent) throws TransformerFactoryConfigurationError, TransformerException {
    Source source = new DOMSource(doc);
    StringWriter sw = new StringWriter();
    Result result = new StreamResult(sw);

    Transformer xformer = TransformerFactory.newInstance().newTransformer();
    xformer.setOutputProperty(OutputKeys.ENCODING, encoding);
View Full Code Here

TOP

Related Classes of javax.xml.transform.Source

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.