Top Description Fields Methods
uk.ac.ed.ph.snuggletex

public Interface SerializationSpecifier

Known Direct Implementers
uk.ac.ed.ph.snuggletex.XMLStringOutputOptions, uk.ac.ed.ph.snuggletex.utilities.SerializationOptions
Imports
uk.ac.ed.ph.snuggletex.utilities.MathMLUtilities, .SerializationOptions, javax.xml.transform.OutputKeys, .TransformerFactory

Interface specifying various options for serializing XML produced by SnuggleTeX and some of its utility classes.

The main implementation of this is XMLStringOutputOptions, which you can use for normal SnuggleTeX functionality. There is also a SerializationOptions implementation that can be used for various utility classes, such as MathMLUtilities.

Author
David McKain
Since
1.2.0
Version
$Revision$
See Also
XMLStringOutputOptions, SerializationOptions

Field Summary

Modifier and TypeField and Description
public static final String
DEFAULT_ENCODING

Default encoding to use

public static final int
DEFAULT_INDENT

Default indent to use when isIndenting() returns true

Method Summary

Modifier and TypeMethod and Description
public String
getDoctypePublic()

Gets the public identifier to use in the resulting DOCTYPE declaration, as described in OutputKeys#DOCTYPE_PUBLIC.

public String
getDoctypeSystem()

Gets the system identifier to use in the resulting DOCTYPE declaration, as described in OutputKeys#DOCTYPE_SYSTEM.

public String
getEncoding()

Gets the encoding for the resulting serialized XML.

public int
getIndent()

Returns the indentation level to use when isIndenting() returns true.

public SerializationMethod
getSerializationMethod()

Gets the SerializationMethod to use when generating the final output.

public boolean
isIncludingXMLDeclaration()

Gets whether to include an XML declaration on the resulting output.

public boolean
isIndenting()

Returns whether the resulting XML will be indented or not.

public boolean
isUsingNamedEntities()

Returns whether to use named entities for certain MathML symbols rather than numeric character references.

public void
setDoctypePublic(String
public identifier to use, null for no identifier.
doctypePublic
)

Sets the public identifier to use in the resulting DOCTYPE declaration, as described in OutputKeys#DOCTYPE_PUBLIC.

public void
setDoctypeSystem(String
system identifier to use, null for no identifier.
doctypeSystem
)

Sets the system identifier to use in the resulting DOCTYPE declaration, as described in OutputKeys#DOCTYPE_SYSTEM.

public void
setEncoding(String
encoding to use, which must be non-null and recognised by the XSLT TransformerFactory that will end up doing the serialization.
encoding
)

Sets the encoding for the resulting serialized XML.

public void
setIncludingXMLDeclaration(boolean
true to include an XML declaration, false otherwise.
includingXMLDeclaration
)

Sets whether to include an XML declaration on the resulting output.

public void
setIndent(int indent)

Sets the indentation level to use when isIndenting() returns true.

public void
setIndenting(boolean
true to indent, false otherwise.
indenting
)

Sets whether the resulting XML will be indented or not.

public void
setSerializationMethod(SerializationMethod
SerializationMethod to use, which must not be null.
serializationMethod
)

Sets the SerializationMethod to use when generating the final output.

public void
setUsingNamedEntities(boolean
true to use named entities, false to default to using numeric character references.
usingNamedEntities
)

Sets whether to use named entities for certain MathML symbols rather than numeric character references.

Field Detail

DEFAULT_ENCODINGback to summary
public static final String DEFAULT_ENCODING

Default encoding to use

DEFAULT_INDENTback to summary
public static final int DEFAULT_INDENT

Default indent to use when isIndenting() returns true

Method Detail

getDoctypePublicback to summary
public String getDoctypePublic()

Gets the public identifier to use in the resulting DOCTYPE declaration, as described in OutputKeys#DOCTYPE_PUBLIC.

Default is null

getDoctypeSystemback to summary
public String getDoctypeSystem()

Gets the system identifier to use in the resulting DOCTYPE declaration, as described in OutputKeys#DOCTYPE_SYSTEM.

Default is null

getEncodingback to summary
public String getEncoding()

Gets the encoding for the resulting serialized XML.

Default is SerializationSpecifier#DEFAULT_ENCODING.

getIndentback to summary
public int getIndent()

Returns the indentation level to use when isIndenting() returns true. (This is currently only supported if your underlying XSLT process is either Saxon or Xalan. This will be the case by if you have chosen to either use Saxon or use the default processor that ships with your Java platform.)

This must be a non-negative integer.

Since
1.2.3
getSerializationMethodback to summary
public SerializationMethod getSerializationMethod()

Gets the SerializationMethod to use when generating the final output.

Default is SerializationMethod#XML. This must not be null.

Note that SerializationMethod#XHTML is only supported properly if you are using an XSLT 2.0 processor; otherwise it reverts to SerializationMethod#XML

isIncludingXMLDeclarationback to summary
public boolean isIncludingXMLDeclaration()

Gets whether to include an XML declaration on the resulting output. Default is false.

isIndentingback to summary
public boolean isIndenting()

Returns whether the resulting XML will be indented or not. (This depends on how clever the underlying XSLT engine will be!)

Default is false.

isUsingNamedEntitiesback to summary
public boolean isUsingNamedEntities()

Returns whether to use named entities for certain MathML symbols rather than numeric character references.

Default is false.

setDoctypePublicback to summary
public void setDoctypePublic(String doctypePublic)

Sets the public identifier to use in the resulting DOCTYPE declaration, as described in OutputKeys#DOCTYPE_PUBLIC.

Parameters
doctypePublic:String

public identifier to use, null for no identifier.

setDoctypeSystemback to summary
public void setDoctypeSystem(String doctypeSystem)

Sets the system identifier to use in the resulting DOCTYPE declaration, as described in OutputKeys#DOCTYPE_SYSTEM.

Parameters
doctypeSystem:String

system identifier to use, null for no identifier.

setEncodingback to summary
public void setEncoding(String encoding)

Sets the encoding for the resulting serialized XML.

Must not be null.

Parameters
encoding:String

encoding to use, which must be non-null and recognised by the XSLT TransformerFactory that will end up doing the serialization.

setIncludingXMLDeclarationback to summary
public void setIncludingXMLDeclaration(boolean includingXMLDeclaration)

Sets whether to include an XML declaration on the resulting output.

Parameters
includingXMLDeclaration:boolean

true to include an XML declaration, false otherwise.

setIndentback to summary
public void setIndent(int indent)

Sets the indentation level to use when isIndenting() returns true. (This is currently only supported if your underlying XSLT process is either Saxon or Xalan. This will be the case by if you have chosen to either use Saxon or use the default processor that ships with your Java platform.)

This must be a non-negative integer.

Since
1.2.3
setIndentingback to summary
public void setIndenting(boolean indenting)

Sets whether the resulting XML will be indented or not. (This depends on how clever the underlying XSLT engine will be!)

Parameters
indenting:boolean

true to indent, false otherwise.

setSerializationMethodback to summary
public void setSerializationMethod(SerializationMethod serializationMethod)

Sets the SerializationMethod to use when generating the final output. This must not be null.

Note that SerializationMethod#XHTML is only supported properly if you are using an XSLT 2.0 processor; otherwise it reverts to SerializationMethod#XML

Parameters
serializationMethod:SerializationMethod

SerializationMethod to use, which must not be null.

setUsingNamedEntitiesback to summary
public void setUsingNamedEntities(boolean usingNamedEntities)

Sets whether to use named entities for certain MathML symbols rather than numeric character references.

Note that this requires an XSLT 2.0-compliant engine (e.g. Saxon, which is in the "full" SnuggleTeX distribution.)

(Also note that the resulting XML won't be parseable unless accompanied with a DTD defining the MathML entities!)

Parameters
usingNamedEntities:boolean

true to use named entities, false to default to using numeric character references.