@Override public Receiver resolve(XPathContext context, String href, String baseUri, SerializationProperties properties) throws XPathException { URI absolute = getAbsoluteUri(href, baseUri); if (absolute.getScheme().equals(dummyBaseOutputUriScheme)) { throw new XPathException("The location of output documents is undefined: use the transform option base-output-uri", "FOXT0002"); } StringWriter writer = new StringWriter(); Serializer serializer = makeSerializer(null); serializer.setCharacterMap(properties.getCharacterMapIndex()); serializer.setOutputWriter(writer); serializer.onClose(() -> results.put(absolute.toASCIIString(), writer.toString())); try { Receiver out = serializer.getReceiver(context.getReceiver().getPipelineConfiguration(), properties); out.setSystemId(absolute.toASCIIString()); return out; } catch (SaxonApiException e) { throw XPathException.makeXPathException(e); } }
@Override public Receiver resolve(XPathContext context, String href, String baseUri, SerializationProperties properties) throws XPathException { URI absolute = getAbsoluteUri(href, baseUri); if (absolute.getScheme().equals(dummyBaseOutputUriScheme)) { throw new XPathException("The location of output documents is undefined: use the transform option base-output-uri", "FOXT0002"); } StringWriter writer = new StringWriter(); Serializer serializer = makeSerializer(null); serializer.setCharacterMap(properties.getCharacterMapIndex()); serializer.setOutputWriter(writer); serializer.onClose(() -> results.put(absolute.toASCIIString(), writer.toString())); try { Receiver out = serializer.getReceiver(context.getReceiver().getPipelineConfiguration(), properties); out.setSystemId(absolute.toASCIIString()); return out; } catch (SaxonApiException e) { throw XPathException.makeXPathException(e); } }
/** * Get an XMLStreamWriter that can be used for writing application-generated XML * to be output via this serializer. * * @return a newly constructed XMLStreamWriter that pipes events into this Serializer * @throws SaxonApiException if any other failure occurs * @since 9.3 */ public StreamWriterToReceiver getXMLStreamWriter() throws SaxonApiException { PipelineConfiguration pipe = processor.getUnderlyingConfiguration().makePipelineConfiguration(); Receiver r = getReceiver(pipe, getSerializationProperties()); r = new NamespaceReducer(r); return new StreamWriterToReceiver(r); }
/** * Get an XMLStreamWriter that can be used for writing application-generated XML * to be output via this serializer. * * @return a newly constructed XMLStreamWriter that pipes events into this Serializer * @throws SaxonApiException if any other failure occurs * @since 9.3 */ public StreamWriterToReceiver getXMLStreamWriter() throws SaxonApiException { PipelineConfiguration pipe = processor.getUnderlyingConfiguration().makePipelineConfiguration(); Receiver r = getReceiver(pipe, getSerializationProperties()); r = new NamespaceReducer(r); return new StreamWriterToReceiver(r); }
/** * Get a ContentHandler that can be used to direct the output of a SAX parser (or other * source of SAX events) to this serializer. * * @return a newly constructed ContentHandler that pipes events into this Serializer * @throws SaxonApiException if any other failure occurs * @since 9.7 */ public org.xml.sax.ContentHandler getContentHandler() throws SaxonApiException { PipelineConfiguration pipe = processor.getUnderlyingConfiguration().makePipelineConfiguration(); Receiver r = getReceiver(pipe, getSerializationProperties()); //r = new SequenceNormalizerWithSpaceSeparator(r); r = new NamespaceReducer(r); ReceivingContentHandler rch = new ReceivingContentHandler(); rch.setReceiver(r); rch.setPipelineConfiguration(r.getPipelineConfiguration()); return rch; }
/** * Get a ContentHandler that can be used to direct the output of a SAX parser (or other * source of SAX events) to this serializer. * * @return a newly constructed ContentHandler that pipes events into this Serializer * @throws SaxonApiException if any other failure occurs * @since 9.7 */ public org.xml.sax.ContentHandler getContentHandler() throws SaxonApiException { PipelineConfiguration pipe = processor.getUnderlyingConfiguration().makePipelineConfiguration(); Receiver r = getReceiver(pipe, getSerializationProperties()); //r = new SequenceNormalizerWithSpaceSeparator(r); r = new NamespaceReducer(r); ReceivingContentHandler rch = new ReceivingContentHandler(); rch.setReceiver(r); rch.setPipelineConfiguration(r.getPipelineConfiguration()); return rch; }