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

public final Class SerializationOptions

extends Object
implements SerializationSpecifier, Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable, uk.ac.ed.ph.snuggletex.SerializationSpecifier
Imports
uk.ac.ed.ph.snuggletex.SerializationMethod, .SerializationSpecifier, .SnuggleLogicException, uk.ac.ed.ph.snuggletex.internal.util.ConstraintUtilities, .ObjectUtilities, javax.xml.transform.OutputKeys, .TransformerFactory

Implementation of SerializationSpecifier that can be used for some of the utility methods in MathMLUtilities.
Author
David McKain
Since
1.2.0
Version
$Revision$

Field Summary

Modifier and TypeField and Description
private String
private String
private String
private boolean
private int
private boolean
private SerializationMethod
private boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object
clone()

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.

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.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

doctypePublicback to summary
private String doctypePublic
doctypeSystemback to summary
private String doctypeSystem
encodingback to summary
private String encoding
includingXMLDeclarationback to summary
private boolean includingXMLDeclaration
indentback to summary
private int indent
indentingback to summary
private boolean indenting
serializationMethodback to summary
private SerializationMethod serializationMethod
usingNamedEntitiesback to summary
private boolean usingNamedEntities

Constructor Detail

SerializationOptionsback to summary
public SerializationOptions()

Method Detail

cloneback to summary
public Object clone()

Overrides java.lang.Object.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Annotations
@Override
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!)

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.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override