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

public Class XMLStringOutputOptions

extends DOMOutputOptions
implements SerializationSpecifier
Class Inheritance
All Implemented Interfaces
uk.ac.ed.ph.snuggletex.SerializationSpecifier
Known Direct Subclasses
uk.ac.ed.ph.snuggletex.WebPageOutputOptions
Imports
uk.ac.ed.ph.snuggletex.utilities.SerializationOptions, javax.xml.transform.OutputKeys, .TransformerFactory

Builds on DOMOutputOptions to add in options for configuring how to build an serialized output consisting of an XML (or possibly HTML) String using the relevant methods in SnuggleSession (e.g. SnuggleSession#buildXMLString(XMLStringOutputOptions)).
Author
David McKain
Since
1.2.0
Version
$Revision$
See Also
DOMOutputOptions, WebPageOutputOptions, WebPageOutputOptionsBuilder

Field Summary

Modifier and TypeField and Description
private final SerializationOptions
Inherited from uk.ac.ed.ph.snuggletex.DOMOutputOptions:
DEFAULT_MATHML_PREFIXDEFAULT_SNUGGLETEX_XML_PREFIXDEFAULT_XHTML_PREFIX

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
getDoctypePublic()

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.getDoctypePublic.

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

public String
getDoctypeSystem()

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.getDoctypeSystem.

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

public String
getEncoding()

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.getEncoding.

Gets the encoding for the resulting serialized XML.

public int
getIndent()

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.getIndent.

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

public SerializationMethod
public boolean
isIncludingXMLDeclaration()

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.isIncludingXMLDeclaration.

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

public boolean
isIndenting()

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.isIndenting.

Returns whether the resulting XML will be indented or not.

public boolean
isUsingNamedEntities()

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.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
)

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.setDoctypePublic.

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
)

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.setDoctypeSystem.

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
)

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.setEncoding.

Sets the encoding for the resulting serialized XML.

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

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.setIncludingXMLDeclaration.

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

public void
setIndent(int indent)

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.setIndent.

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

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

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.setIndenting.

Sets whether the resulting XML will be indented or not.

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

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.setSerializationMethod.

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
)

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.setUsingNamedEntities.

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

Inherited from uk.ac.ed.ph.snuggletex.DOMOutputOptions:
addDOMPostProcessorsclonegetDOMPostProcessorsgetErrorOutputOptionsgetInlineCSSPropertiesgetLinkResolvergetMathMLPrefixgetSnuggleXMLPrefixgetXHTMLPrefixisAddingMathAnnotationsisAddingMathSourceAnnotationsisApplyingFirefox3SemanticsWorkaroundisInliningCSSisMathVariantMappingisPrefixingMathMLisPrefixingSnuggleXMLisPrefixingXHTMLsetAddingMathAnnotationssetAddingMathSourceAnnotationssetApplyingFirefox3SemanticsWorkaroundsetDOMPostProcessorssetErrorOutputOptionssetInlineCSSPropertiessetInliningCSSsetLinkResolversetMathMLPrefixsetMathVariantMappingsetPrefixingMathMLsetPrefixingSnuggleXMLsetPrefixingXHTMLsetSnuggleXMLPrefixsetXHTMLPrefix

Field Detail

serializationOptionsback to summary
private final SerializationOptions serializationOptions

Constructor Detail

XMLStringOutputOptionsback to summary
public XMLStringOutputOptions()

Method Detail

getDoctypePublicback to summary
public String getDoctypePublic()

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.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()

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.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()

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.getEncoding.

Gets the encoding for the resulting serialized XML.

Default is SerializationSpecifier#DEFAULT_ENCODING.

getIndentback to summary
public int getIndent()

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.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. The default value is SerializationSpecifier#DEFAULT_INDENT.

Since
1.2.3
getSerializationMethodback to summary
public SerializationMethod getSerializationMethod()

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.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()

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.isIncludingXMLDeclaration.

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

isIndentingback to summary
public boolean isIndenting()

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.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()

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.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)

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.setDoctypePublic.

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)

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.setDoctypeSystem.

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)

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.setEncoding.

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)

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.setIncludingXMLDeclaration.

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)

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.setIndent.

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. The default value is SerializationSpecifier#DEFAULT_INDENT.

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

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.setIndenting.

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

Note

The old version of Xalan that comes bundled with Java 6 (and below) appears to be unable to indent output when using XMLStringOutputOptions#setIndenting(boolean) with SerializationMethod#HTML. I have not checked this behaviour with Java 7 (or above). I however recommend using Saxon, or including a newer version of Xalan in the ClassPath.

Parameters
indenting:boolean

true to indent, false otherwise.

setSerializationMethodback to summary
public void setSerializationMethod(SerializationMethod serializationMethod)

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.setSerializationMethod.

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)

Implements uk.ac.ed.ph.snuggletex.SerializationSpecifier.setUsingNamedEntities.

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). This option will be silently ignored if you are using an XSLT 1.0 engine, such as the one which typically comes bundled with your JDK.

(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.