/** * Construct a StreamSource from a File. * * @param f Must a non-null File reference. */ public StreamSource(File f) { setSystemId(f); }
private static Transformer getTransformer(String stylesheet) throws Exception { Transformer transformer = null; InputStream xslStream = null; try { InputStream in = XSLTransformation.class.getResourceAsStream( stylesheet ); xslStream = new BufferedInputStream( in ); StreamSource src = new StreamSource( xslStream ); src.setSystemId( stylesheet ); transformer = TransformerFactory.newInstance().newTransformer( src ); } finally { if ( xslStream != null ) xslStream.close(); } return transformer; } }
/** * Construct a StreamSource from a character reader. Normally, * a stream should be used rather than a reader, so that * the XML parser may resolve character encoding specified * by the XML declaration. However, in many cases the encoding * of the input stream is already resolved, as in the case of * reading XML from a StringReader. * * @param reader A valid Reader reference to an XML character stream. * @param systemId Must be a String that conforms to the URI syntax. */ public StreamSource(Reader reader, String systemId) { setReader(reader); setSystemId(systemId); }
/** * Construct a StreamSource from a byte stream. Normally, * a stream should be used rather than a reader, so that * the XML parser can resolve character encoding specified * by the XML declaration. * * <p>This constructor allows the systemID to be set in addition * to the input stream, which allows relative URIs * to be processed.</p> * * @param inputStream A valid InputStream reference to an XML stream. * @param systemId Must be a String that conforms to the URI syntax. */ public StreamSource(InputStream inputStream, String systemId) { setInputStream(inputStream); setSystemId(systemId); }
xsl.setSystemId(stylesheet);
/** * Construct a StreamSource from a File. * * @param f Must a non-null File reference. */ public StreamSource(File f) { setSystemId(f); }
/** * Construct a StreamSource from a File. * * @param f Must a non-null File reference. */ public StreamSource(File f) { setSystemId(f); }
/** * Construct a StreamSource from a File. * * @param f Must a non-null File reference. */ public StreamSource(File f) { setSystemId(f); }
/** * Construct a StreamSource from a File. * * @param f Must a non-null File reference. */ public StreamSource(File f) { setSystemId(f); }
/** * Construct a StreamSource from a File. * * @param f Must a non-null File reference. */ public StreamSource(File f) { setSystemId(f); }
/** * Construct a StreamSource from a File. * * @param f Must a non-null File reference. */ public StreamSource(File f) { setSystemId(f); }
/** * Construct a StreamSource from a File. * * @param f Must a non-null File reference. */ public StreamSource(File f) { //convert file to appropriate URI, f.toURI().toASCIIString() //converts the URI to string as per rule specified in //RFC 2396, setSystemId(f.toURI().toASCIIString()); }
public Source resolve(String href, String base) { StreamSource source = new StreamSource(getInputStream(href)); // this works with saxon7/saxon6.5.2/xalan source.setSystemId(href); return source; }
public void setStylesheet(File stylesheet) throws Exception { xslStream = new FileInputStream(stylesheet); StreamSource src = new StreamSource(xslStream); src.setSystemId(getSystemId(stylesheet)); templates = tfactory.newTemplates(src); transformer = templates.newTransformer(); }
public Source resolve(String href, String base) { StreamSource source = new StreamSource(getInputStream(href)); // this works with saxon7/saxon6.5.2/xalan source.setSystemId(href); return source; }
public Schema getSchema() throws IOException, SAXException { SchemaFactory schemaFactory = SchemaFactory.newInstance( XMLConstants.W3C_XML_SCHEMA_NS_URI ); StreamSource source = new StreamSource( this.getSchemaAsInputStream() ); source.setSystemId( this.getSchemaRemoteResourceUri().toString() ); return schemaFactory.newSchema( source ); } }
public Schema getSchema() throws IOException, SAXException { SchemaFactory schemaFactory = SchemaFactory.newInstance( XMLConstants.W3C_XML_SCHEMA_NS_URI ); StreamSource source = new StreamSource( this.getSchemaAsInputStream() ); source.setSystemId( this.getSchemaRemoteResourceUri().toString() ); return schemaFactory.newSchema( source ); } }
private XMLStreamReader createXMLStreamReader(InputSource source) throws UnmarshalException { StreamSource streamSource = new StreamSource(); streamSource.setSystemId(source.getSystemId()); streamSource.setPublicId(source.getPublicId()); streamSource.setInputStream(source.getByteStream()); streamSource.setReader(source.getCharacterStream()); XMLStreamReader streamReader = createXMLStreamReader(streamSource); return streamReader; }
private XMLStreamReader createXMLStreamReader(InputSource source) throws UnmarshalException { StreamSource streamSource = new StreamSource(); streamSource.setSystemId(source.getSystemId()); streamSource.setPublicId(source.getPublicId()); streamSource.setInputStream(source.getByteStream()); streamSource.setReader(source.getCharacterStream()); XMLStreamReader streamReader = createXMLStreamReader(streamSource); return streamReader; }
/** * Returns a stream of XML markup. * * @return A stream of XML markup. * @throws IOException */ public StreamSource getStreamSource() throws IOException { final StreamSource result = new StreamSource(getStream()); if (getIdentifier() != null) { result.setSystemId(getIdentifier().getTargetRef().toString()); } return result; }