/** * Construct a StreamSource from a character reader. Normally, * a stream should be used rather than a reader, so that * the XML parser can 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. */ public StreamSource(Reader reader) { setReader(reader); }
/** * 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 character reader. Normally, * a stream should be used rather than a reader, so that * the XML parser can 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. */ public StreamSource(Reader reader) { setReader(reader); }
/** * Construct a StreamSource from a character reader. Normally, * a stream should be used rather than a reader, so that * the XML parser can 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. */ public StreamSource(Reader reader) { setReader(reader); }
/** * Construct a StreamSource from a character reader. Normally, * a stream should be used rather than a reader, so that * the XML parser can 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. */ public StreamSource(Reader reader) { setReader(reader); }
/** * Construct a StreamSource from a character reader. Normally, * a stream should be used rather than a reader, so that * the XML parser can 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. */ public StreamSource(Reader reader) { setReader(reader); }
/** * Construct a StreamSource from a character reader. Normally, * a stream should be used rather than a reader, so that * the XML parser can 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. */ public StreamSource(Reader reader) { setReader(reader); }
/** * Construct a StreamSource from a character reader. Normally, * a stream should be used rather than a reader, so that * the XML parser can 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. */ public StreamSource(Reader reader) { setReader(reader); }
/** * Construct a StreamSource from a character reader. Normally, * a stream should be used rather than a reader, so that * the XML parser can 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. */ public StreamSource(Reader reader) { setReader(reader); }
public static Schema getSchema(String schemaString) { Schema schema = null; try { if (schemaString != null) { SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); StreamSource ss = new StreamSource(); ss.setReader(new StringReader(schemaString)); schema = sf.newSchema(ss); } } catch (Exception e) { throw new RuntimeException("Failed to create schemma from string: " + schemaString, e); } return schema; }
/** * 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 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 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 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 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 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 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); }
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; }
/** * Removes any references to InputStreams or Readers from the given Source to prohibit * accidental/unwanted use by a component further downstream. * @param src the Source object */ public static void removeStreams(Source src) { if (src instanceof ImageSource) { ImageSource isrc = (ImageSource) src; isrc.setImageInputStream(null); } else if (src instanceof StreamSource) { StreamSource ssrc = (StreamSource) src; ssrc.setInputStream(null); ssrc.setReader(null); } else if (src instanceof SAXSource) { InputSource is = ((SAXSource) src).getInputSource(); if (is != null) { is.setByteStream(null); is.setCharacterStream(null); } } }