Saxon.Api

Class DocumentBuilder

Class DomDestination

Class DynamicContext

Class DynamicError

Class EmptyEnumerator

Class ExtensionFunctionCall

Class ExtensionFunctionDefinition

Class InvalidityHandlerWrapper

Class NamespaceConstant

Class NullDestination

Class Processor

Class QName

Class SchemaManager

Class SchemaValidator

Class Serializer

Class StandardLogger

Class StaticContext

Class StaticError

Class TextWriterDestination

Class WhitespacePolicy

Class XPathCompiler

Class XPathExecutable

Class XPathSelector

Class XQueryCompiler

Class XQueryEvaluator

Class XQueryExecutable

Class XdmAnyFunctionType

Class XdmAnyItemType

Class XdmAnyNodeType

Class XdmArray

Class XdmAtomicType

Class XdmAtomicValue

Class XdmDestination

  - Class TreeProtector

Class XdmEmptySequence

Class XdmExternalObjectValue

Class XdmFunctionItem

Class XdmItem

Class XdmItemType

Class XdmMap

Class XdmNode

Class XdmNodeKind

Class XdmSequenceType

Class XdmValue

Class XmlDestination

Class Xslt30Transformer

Class XsltCompiler

Class XsltExecutable

  - Class ParameterDetails

Class XsltPackage

Class XsltTransformer

Enum RecoveryPolicy

Enum SchemaValidationMode

Enum TreeModel

Enum XdmAxis

Interface IInvalidityHandler

Interface IMessageListener

Interface IQueryResolver

Interface IResultDocumentHandler

Interface IXdmEnumerator

Interface IXmlLocation

Interface SchemaResolver

 

Saxon.Api
Class Serializer


public class Serializer
extends XmlDestination

A Serializer takes a tree representation of XML and turns it into lexical XML markup.

Note that this is serialization in the sense of the W3C XSLT and XQuery specifications. Unlike the class System.Xml.Serialization.XmlSerializer, this object does not serialize arbitrary CLI objects.


Field Summary
static QName METHOD

QName identifying the serialization parameter "method". If the method is a user-defined method, then it is given as a QName in Clark notation, that is "{uri}local".

static QName BYTE_ORDER_MARK

QName identifying the serialization parameter "byte-order-mark"

static QName CDATA_SECTION_ELEMENTS

QName identifying the serialization parameter "cdata-section-elements". The value of this parameter is given as a space-separated list of expanded QNames in Clark notation, that is "{uri}local".

static QName DOCTYPE_PUBLIC

QName identifying the serialization parameter "doctype-public"

static QName DOCTYPE_SYSTEM

QName identifying the serialization parameter "doctype-system"

static QName ENCODING

QName identifying the serialization parameter "encoding"

static QName ESCAPE_URI_ATTRIBUTES

QName identifying the serialization parameter "escape-uri-attributes". The value is the string "yes" or "no".

static QName INCLUDE_CONTENT_TYPE

QName identifying the serialization parameter "include-content-type". The value is the string "yes" or "no".

static QName INDENT

QName identifying the serialization parameter "indent". The value is the string "yes" or "no".

static QName MEDIA_TYPE

QName identifying the serialization parameter "media-type".

static QName NORMALIZATION_FORM

QName identifying the serialization parameter "normalization-form"

static QName OMIT_XML_DECLARATION

QName identifying the serialization parameter "omit-xml-declaration". The value is the string "yes" or "no".

static QName STANDALONE

QName identifying the serialization parameter "standalone". The value is the string "yes" or "no" or "omit".

static QName SUPPRESS_INDENTATION

QName identifying the serialization parameter "suppress-indentation" (introduced in XSLT/XQuery 3.0). Previously available as "saxon:suppress-indentation" The value is the string "yes" or "no" or "omit".

static QName UNDECLARE_PREFIXES

QName identifying the serialization parameter "undeclare-prefixes". The value is the string "yes" or "no".

static QName USE_CHARACTER_MAPS

QName identifying the serialization parameter "use-character-maps". This is available only with XSLT. The value of the parameter is a list of expanded QNames in Clark notation giving the names of character maps defined in the XSLT stylesheet.

static QName VERSION

QName identifying the serialization parameter "version"

static QName SAXON_CHARACTER_REPRESENTATION

QName identifying the serialization parameter "saxon:character-representation"

static QName SAXON_INDENT_SPACES

QName identifying the serialization parameter "saxon:indent-spaces". The value is an integer (represented as a string) indicating the amount of indentation required. If specified, this parameter overrides indent="no".

static QName SAXON_DOUBLE_SPACE

QName identifying the serialization parameter "saxon:double-space". The value of this parameter is given as a space-separated list of expanded QNames in Clark notation, that is "{uri}local"; each QName identifies an element that should be preceded by an extra blank line within indented output.

static QName SAXON_SUPPRESS_INDENTATION

QName identifying the serialization parameter "saxon:double-space". The value of this parameter is given as a space-separated list of expanded QNames in Clark notation, that is "{uri}local"; each QName identifies an element whose content should not be indented even when indent=yes is specified.

static QName NEXT_IN_CHAIN

QName identifying the serialization parameter "saxon:next-in-chain". This is available only with XSLT, and identifies the URI of a stylesheet that is to be used to process the results before passing them to their final destination.

static QName SAXON_REQUIRE_WELL_FORMED

QName identifying the serialization parameter "saxon:require-well-formed". The value is the string "yes" or "no". If set to "yes", the output must be a well-formed document, or an error will be reported. ("Well-formed" here means that the document node must have exactly one element child, and no text node children other than whitespace-only text nodes).

 
Constructor Summary
Serializer()

Create a Serializer

 
Method Summary
 void SetOutputProperty(QName name, string value)

Set a serialization property

 void SetDefaultOutputProperties(java.util.Properties props)

Set default output properties, for use when no explicit properties are set using SetProperty(). The values supplied are typically those specified in the stylesheet or query. In the case of XSLT, they are the properties associated with unamed xsl:output declarations.

 void SetCharacterMap(net.sf.saxon.serialize.CharacterMapIndex charMap)

Set a character map to be used

 void SetOutputFile(string filename)

Specify the destination of the serialized output, in the form of a file name

 void SetOutputStream(System.IO.Stream stream)

Specify the destination of the serialized output, in the form of a Stream

 java.io.OutputStream GetOutputDestination()
 void SetProcessor(Processor processor)

Set the Processor associated with this Serializer. This will be called automatically if the serializer is created using one of the Processor.NewSerializer() methods.

 void SetOutputWriter(System.IO.TextWriter textWriter)

Specify the destination of the serialized output, in the form of a TextWriter

 net.sf.saxon.event.Receiver GetReceiver(net.sf.saxon.event.PipelineConfiguration pipe)
 java.util.Properties GetOutputProperties()

 void SerializeXdmNode(XdmNode node)

Serialize an XdmNode to the selected output destination using this serializer

 void SerializeXdmValue(XdmValue value)

Serialize an arbitary 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 document nodes is then serialized using the serialization parameters defined in this serializer. A call on this method will close the writer or output stream internally.

 void Close()

 
Field Detail

METHOD

public static readonly QName METHOD

QName identifying the serialization parameter "method". If the method is a user-defined method, then it is given as a QName in Clark notation, that is "{uri}local".


BYTE_ORDER_MARK

public static readonly QName BYTE_ORDER_MARK

QName identifying the serialization parameter "byte-order-mark"


CDATA_SECTION_ELEMENTS

public static readonly QName CDATA_SECTION_ELEMENTS

QName identifying the serialization parameter "cdata-section-elements". The value of this parameter is given as a space-separated list of expanded QNames in Clark notation, that is "{uri}local".


DOCTYPE_PUBLIC

public static readonly QName DOCTYPE_PUBLIC

QName identifying the serialization parameter "doctype-public"


DOCTYPE_SYSTEM

public static readonly QName DOCTYPE_SYSTEM

QName identifying the serialization parameter "doctype-system"


ENCODING

public static readonly QName ENCODING

QName identifying the serialization parameter "encoding"


ESCAPE_URI_ATTRIBUTES

public static readonly QName ESCAPE_URI_ATTRIBUTES

QName identifying the serialization parameter "escape-uri-attributes". The value is the string "yes" or "no".


INCLUDE_CONTENT_TYPE

public static readonly QName INCLUDE_CONTENT_TYPE

QName identifying the serialization parameter "include-content-type". The value is the string "yes" or "no".


INDENT

public static readonly QName INDENT

QName identifying the serialization parameter "indent". The value is the string "yes" or "no".


MEDIA_TYPE

public static readonly QName MEDIA_TYPE

QName identifying the serialization parameter "media-type".


NORMALIZATION_FORM

public static readonly QName NORMALIZATION_FORM

QName identifying the serialization parameter "normalization-form"


OMIT_XML_DECLARATION

public static readonly QName OMIT_XML_DECLARATION

QName identifying the serialization parameter "omit-xml-declaration". The value is the string "yes" or "no".


STANDALONE

public static readonly QName STANDALONE

QName identifying the serialization parameter "standalone". The value is the string "yes" or "no" or "omit".


SUPPRESS_INDENTATION

public static readonly QName SUPPRESS_INDENTATION

QName identifying the serialization parameter "suppress-indentation" (introduced in XSLT/XQuery 3.0). Previously available as "saxon:suppress-indentation" The value is the string "yes" or "no" or "omit".


UNDECLARE_PREFIXES

public static readonly QName UNDECLARE_PREFIXES

QName identifying the serialization parameter "undeclare-prefixes". The value is the string "yes" or "no".


USE_CHARACTER_MAPS

public static readonly QName USE_CHARACTER_MAPS

QName identifying the serialization parameter "use-character-maps". This is available only with XSLT. The value of the parameter is a list of expanded QNames in Clark notation giving the names of character maps defined in the XSLT stylesheet.


VERSION

public static readonly QName VERSION

QName identifying the serialization parameter "version"


SAXON_CHARACTER_REPRESENTATION

public static readonly QName SAXON_CHARACTER_REPRESENTATION

QName identifying the serialization parameter "saxon:character-representation"


SAXON_INDENT_SPACES

public static readonly QName SAXON_INDENT_SPACES

QName identifying the serialization parameter "saxon:indent-spaces". The value is an integer (represented as a string) indicating the amount of indentation required. If specified, this parameter overrides indent="no".


SAXON_DOUBLE_SPACE

public static readonly QName SAXON_DOUBLE_SPACE

QName identifying the serialization parameter "saxon:double-space". The value of this parameter is given as a space-separated list of expanded QNames in Clark notation, that is "{uri}local"; each QName identifies an element that should be preceded by an extra blank line within indented output.


SAXON_SUPPRESS_INDENTATION

public static readonly QName SAXON_SUPPRESS_INDENTATION

QName identifying the serialization parameter "saxon:double-space". The value of this parameter is given as a space-separated list of expanded QNames in Clark notation, that is "{uri}local"; each QName identifies an element whose content should not be indented even when indent=yes is specified.


NEXT_IN_CHAIN

public static readonly QName NEXT_IN_CHAIN

QName identifying the serialization parameter "saxon:next-in-chain". This is available only with XSLT, and identifies the URI of a stylesheet that is to be used to process the results before passing them to their final destination.


SAXON_REQUIRE_WELL_FORMED

public static readonly QName SAXON_REQUIRE_WELL_FORMED

QName identifying the serialization parameter "saxon:require-well-formed". The value is the string "yes" or "no". If set to "yes", the output must be a well-formed document, or an error will be reported. ("Well-formed" here means that the document node must have exactly one element child, and no text node children other than whitespace-only text nodes).


Constructor Detail

Serializer

public Serializer()

Create a Serializer


Method Detail

SetOutputProperty

public void SetOutputProperty(QName name,
string value)

Set a serialization property

In the case of XSLT, properties set within the serializer override any properties set in xsl:output declarations in the stylesheet. Similarly, with XQuery, they override any properties set in the Query prolog using declare option saxon:output.

Parameters:
name -
The name of the serialization property to be set
value -
The value to be set for the serialization property. May be null to unset the property (that is, to set it back to the default value).

SetDefaultOutputProperties

public void SetDefaultOutputProperties(java.util.Properties props)

Set default output properties, for use when no explicit properties are set using SetProperty(). The values supplied are typically those specified in the stylesheet or query. In the case of XSLT, they are the properties associated with unamed xsl:output declarations.

Parameters:
props -

SetCharacterMap

public void SetCharacterMap(net.sf.saxon.serialize.CharacterMapIndex charMap)

Set a character map to be used

Parameters:
charMap -
the character map

SetOutputFile

public void SetOutputFile(string filename)
throws
DynamicError

Specify the destination of the serialized output, in the form of a file name

Parameters:
filename -
The name of the file to receive the serialized output
Throws:
DynamicError - Throws a DynamicError if it is not possible to create an output stream to write to this file, for example, if the filename is in a directory that does not exist.

SetOutputStream

public void SetOutputStream(System.IO.Stream stream)

Specify the destination of the serialized output, in the form of a Stream

Saxon will not close the stream on completion; this is the caller's responsibility.

Parameters:
stream -
The stream to which the output will be written. This must be a stream that allows writing.

GetOutputDestination

public java.io.OutputStream GetOutputDestination()

SetProcessor

public void SetProcessor(Processor processor)

Set the Processor associated with this Serializer. This will be called automatically if the serializer is created using one of the Processor.NewSerializer() methods.

Parameters:
processor -
processor the associated Processor

SetOutputWriter

public void SetOutputWriter(System.IO.TextWriter textWriter)

Specify the destination of the serialized output, in the form of a TextWriter

Note that when writing to a TextWriter, character encoding is the responsibility of the TextWriter, not the Serializer. This means that the encoding requested in the output properties is ignored; it also means that characters that cannot be represented in the target encoding will use whatever fallback representation the TextWriter defines, rather than being represented as XML character references.

Parameters:
textWriter -
The stream to which the output will be written. This must be a stream that allows writing. Saxon will not close the textWriter on completion; this is the caller's responsibility.

GetReceiver

public override net.sf.saxon.event.Receiver GetReceiver(net.sf.saxon.event.PipelineConfiguration pipe)

GetOutputProperties

public override java.util.Properties GetOutputProperties()


SerializeXdmNode

public void SerializeXdmNode(XdmNode node)

Serialize an XdmNode to the selected output destination using this serializer

since 9.8

Parameters:
node -
The node to be serialized

SerializeXdmValue

public void SerializeXdmValue(XdmValue value)

Serialize an arbitary 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 document nodes is then serialized using the serialization parameters defined in this serializer. A call on this method will close the writer or output stream internally.

since 9.8

Parameters:
value -
The value to be serialized

Close

public override void Close()