/** * Serialize an arbitrary XdmValue to the selected output destination using this serializer. The supplied * sequence is first wrapped in a document node according to the rules given in section 2 (Sequence Normalization) of the * <a href="http://www.w3.org/TR/xslt-xquery-serialization/">XSLT/XQuery serialization specification</a>; the resulting * document nodes is then serialized using the serialization parameters defined in this serializer. * * @param value The value to be serialized * @throws IllegalStateException if no outputStream, Writer, or File has been supplied as the * destination for the serialized output, or if no Processor is associated with the serializer * @throws SaxonApiException if a serialization error or I/O error occurs * @since 9.3 */ public void serializeXdmValue(XdmValue value) throws SaxonApiException { if (value instanceof XdmNode) { serializeNode((XdmNode) value); } else { try { QueryResult.serializeSequence(value.getUnderlyingValue().iterate(), processor.getUnderlyingConfiguration(), result, getLocallyDefinedProperties()); } catch (XPathException e) { throw new SaxonApiException(e); } } closeAndNotify(); }
/** * Serialize an arbitrary XdmValue to the selected output destination using this serializer. The supplied * sequence is first wrapped in a document node according to the rules given in section 2 (Sequence Normalization) of the * <a href="http://www.w3.org/TR/xslt-xquery-serialization/">XSLT/XQuery serialization specification</a>; the resulting * document nodes is then serialized using the serialization parameters defined in this serializer. * * @param value The value to be serialized * @throws IllegalStateException if no outputStream, Writer, or File has been supplied as the * destination for the serialized output, or if no Processor is associated with the serializer * @throws SaxonApiException if a serialization error or I/O error occurs * @since 9.3 */ public void serializeXdmValue(XdmValue value) throws SaxonApiException { if (value instanceof XdmNode) { serializeNode((XdmNode) value); } else { try { QueryResult.serializeSequence(value.getUnderlyingValue().iterate(), processor.getUnderlyingConfiguration(), result, getLocallyDefinedProperties()); } catch (XPathException e) { throw new SaxonApiException(e); } } closeAndNotify(); }