Package javax.xml.transform

Examples of javax.xml.transform.Source


                        }

                        schemaSourcesMap.put(sch.getSourceURI() + ":"
                                             + sch.getTargetNamespace(), out.toByteArray());
                       
                        Source source = new StreamSource(out.createInputStream(), sch.getSourceURI());
                        schemaSourcesMap2.put(sch.getSourceURI() + ":"
                                              + sch.getTargetNamespace(), source);
                    }
                }
View Full Code Here


          
            return doc;
        }

        public Source invoke(Source request) {
            Source ret = null;
            try {
                //Bug in JAXB - if you pass the StaxSource or SaxSource into unmarshall,
                //the namespaces for the QNames for the Types elements are lost.
                //Since WS-Discovery messages are small (UDP datagram size), parsing to DOM
                //is not a HUGE deal
View Full Code Here

    }

    public static InputStream transform(Templates xsltTemplate, InputStream in) {
        try {
            XMLStreamReader reader = StaxUtils.createXMLStreamReader(in);
            Source beforeSource = new StaxSource(reader);
            CachedOutputStream out = new CachedOutputStream();

            Transformer trans = xsltTemplate.newTransformer();
            trans.transform(beforeSource, new StreamResult(out));
View Full Code Here

    }

    public static Reader transform(Templates xsltTemplate, Reader inReader) {
        try {
            XMLStreamReader reader = StaxUtils.createXMLStreamReader(inReader);
            Source beforeSource = new StaxSource(reader);
            CachedWriter outWriter = new CachedWriter();

            Transformer trans = xsltTemplate.newTransformer();
            trans.transform(beforeSource, new StreamResult(outWriter));
View Full Code Here

       
        // Test request-response
        InputStream is = getClass().getResourceAsStream("resources/GreetMeDocLiteralSOAPBodyReq.xml");
        StAXSource staxSourceReq = new StAXSource(StaxUtils.createXMLStreamReader(is));
        assertNotNull(staxSourceReq);
        Source resp = disp.invoke(staxSourceReq);
        assertNotNull(resp);
        assertTrue(resp instanceof StAXSource);
        String expected = "Hello TestSOAPInputMessage";
        String actual = StaxUtils.toString(StaxUtils.read(resp));
        assertTrue("Expected: " + expected, actual.contains(expected));
View Full Code Here

                        }

                        schemaSourcesMap.put(sch.getSourceURI() + ":"
                                             + sch.getTargetNamespace(), out.toByteArray());
                       
                        Source source = new StreamSource(out.createInputStream(), sch.getSourceURI());
                        schemaSourcesMap2.put(sch.getSourceURI() + ":"
                                              + sch.getTargetNamespace(), source);
                    }
                }
View Full Code Here

     * @return An InputSource with the loaded document
     */
    public InputSource loadSource(String href, String context, XSLTC xsltc) {
  try {
      if (_uriResolver != null) {
    final Source source = _uriResolver.resolve(href, context);
    if (source != null) {
        return Util.getInputSource(xsltc, source);
    }
      }
  }
View Full Code Here

        // Did they pass in a stylesheet, or should we get it from the
        // document?
        if (null == stylesheet)
        {
          Source source =
            stf.getAssociatedStylesheet(new StreamSource(inFileName), media,
                                        null, null);

          if (null != source)
            stylesheet = tfactory.newTemplates(source);
View Full Code Here

            fis = new BufferedInputStream(new FileInputStream(infile));
            fos = new BufferedOutputStream(new FileOutputStream(outfile));
            StreamResult res = new StreamResult(fos);
            // not sure what could be the need of this...
            res.setSystemId(JAXPUtils.getSystemId(outfile));
            Source src = getSource(fis, infile);

            // set parameters on each transformation, maybe something has changed
            //(e.g. value of file name parameter)
            setTransformationParameters();
View Full Code Here

    private Source getSource(InputStream is, File infile)
        throws ParserConfigurationException, SAXException {
        // todo: is this comment still relevant ??
        // FIXME: need to use a SAXSource as the source for the transform
        // so we can plug in our own entity resolver
        Source src = null;
        if (entityResolver != null) {
            if (getFactory().getFeature(SAXSource.FEATURE)) {
                SAXParserFactory spFactory = SAXParserFactory.newInstance();
                spFactory.setNamespaceAware(true);
                XMLReader reader = spFactory.newSAXParser().getXMLReader();
                reader.setEntityResolver(entityResolver);
                src = new SAXSource(reader, new InputSource(is));
            } else {
                throw new IllegalStateException("xcatalog specified, but "
                    + "parser doesn't support SAX");
            }
        } else {
            // WARN: Don't use the StreamSource(File) ctor. It won't work with
            // xalan prior to 2.2 because of systemid bugs.
            src = new StreamSource(is);
        }
        src.setSystemId(JAXPUtils.getSystemId(infile));
        return src;
    }
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.