This class is a Source implementation that reads the textual format of an XML document from a file, byte stream, or character stream. Because XML documents declare their own encoding, it is preferable to create a StreamSource object from an InputStream instead of from a Reader , so that the XML processor can correctly handle the declared encoding. When creating a StreamSource from a byte stream or character stream, you should provide the "system id" (i.e. the filename or URL) by using one of the two-argument constructors or by caling setSystemId( ) . The system id is required if the XML file to be processed includes relative URLs to be resolved. Figure 20-17. javax.xml.transform.stream.StreamSourcepublic class StreamSource implements javax.xml.transform.Source { // Public Constructors public StreamSource ( ); public StreamSource (java.io.InputStream inputStream ); public StreamSource (java.io.Reader reader ); public StreamSource (java.io.File f ); public StreamSource (String systemId ); public StreamSource (java.io.Reader reader , String systemId ); public StreamSource (java.io.InputStream inputStream , String systemId ); // Public Constants public static final String FEATURE ; = "http://javax.xml.transform.stream.StreamSource/feature" // Public Instance Methods public java.io.InputStream getInputStream ( ); default:null public String getPublicId ( ); default:null public java.io.Reader getReader ( ); default:null public void setInputStream (java.io.InputStream inputStream ); public void setPublicId (String publicId ); public void setReader (java.io.Reader reader ); public void setSystemId (java.io.File f ); // Methods Implementing Source public String getSystemId ( ); default:null public void setSystemId (String systemId ); } |