Package javax.xml.transform

Examples of javax.xml.transform.Source


        public static String transform(String stylesheet,
                                       String srcXMLString,
                                       HashMap<String, String> params) throws Exception {
            StringWriter writer = new StringWriter();
            StreamResult result = new StreamResult( writer );
            Source src = new StreamSource( new StringReader( srcXMLString ) );
            transform( stylesheet,
                       src,
                       result,
                       params );
            return writer.toString();
View Full Code Here


      Writer writer = new PrintWriter(bout);

      MappedNamespaceConvention con = new MappedNamespaceConvention();
      XMLStreamWriter streamWriter = new ResultAdapter(con, writer);

      Source source = new DOMSource(root);
      //Result output = new StAXResult(streamWriter); JDK 6 only
      Result output = new SAXResult((ContentHandler)streamWriter);

      Transformer transformer = TransformerFactory.newInstance().newTransformer();
      transformer.transform(source, output);
View Full Code Here

  }

  private static final String P_OUTPUT_VALIDATE_STRUCTURE = "com.ctc.wstx.outputValidateStructure"; //$NON-NLS-1$
   
  public static ClobType xslTransform(CommandContext context, Object xml, Object styleSheet) throws Exception {
      Source styleSource = null;
    Source xmlSource = null;
    try {
      styleSource = convertToSource(styleSheet);
      xmlSource = convertToSource(xml);
      final Source xmlParam = xmlSource;
      TransformerFactory factory = TransformerFactory.newInstance();
            final Transformer transformer = factory.newTransformer(styleSource);
           
      //this creates a non-validated sqlxml - it may not be valid xml/root-less xml
      SQLXMLImpl result = XMLSystemFunctions.saveToBufferManager(context.getBufferManager(), new XMLTranslator() {
View Full Code Here

    }
      throw new AssertionError("Unknown type"); //$NON-NLS-1$
    }

    public static String xpathValue(Object doc, String xpath) throws XPathException, TeiidProcessingException {
      Source s = null;
        try {
          s = convertToSource(doc);
            XPathEvaluator eval = new XPathEvaluator();
            // Wrap the string() function to force a string return            
            XPathExpression expr = eval.createExpression(xpath);
View Full Code Here

            }
          } catch (TransformerException e) {
            throw new TeiidProcessingException(e);
          }
          if (context != null) {
            Source source = XMLSystemFunctions.convertToSource(context);
            result.sources.add(source);
              if (contextRoot != null) {
                //create our own filter as this logic is not provided in the free saxon
                  ProxyReceiver filter = new PathMapFilter(contextRoot);
                  AugmentedSource sourceInput = AugmentedSource.makeAugmentedSource(source);
View Full Code Here

        Document document = DOMUtils.readXml(getResourceAsStream("echo-payload.xml"));

        DOMSource source = new DOMSource(document.getDocumentElement());
       
        Source object = d.invoke(source);
        assertNotNull(object);
    }
View Full Code Here


  public Catalog parse( URI documentUri )
          throws ThreddsXmlParserException
  {
    Source s = StaxThreddsXmlParserUtils.getSourceFromUri( documentUri );
    try
    {
      return readCatalogXML( s ).build();
    }
    catch ( BuilderException e )
View Full Code Here

  }

  public CatalogBuilder parseIntoBuilder( URI documentUri )
          throws ThreddsXmlParserException
  {
    Source s = StaxThreddsXmlParserUtils.getSourceFromUri( documentUri );
    return readCatalogXML( s );
  }
View Full Code Here

  }

  public CatalogBuilder parseIntoBuilder( File file, URI docBaseUri )
          throws ThreddsXmlParserException
  {
    Source s = StaxThreddsXmlParserUtils.getSourceFromFile( file, docBaseUri );
    return readCatalogXML( s );
  }
View Full Code Here

  }

  public CatalogBuilder parseIntoBuilder( Reader reader, URI docBaseUri )
          throws ThreddsXmlParserException
  {
    Source source = new StreamSource( reader, docBaseUri.toString() );
    return readCatalogXML( source );
  }
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.