Package org.faceless.publisher.ext
Class ContentMathMLExtension.ContentMathMLContentHandler
java.lang.Object
org.faceless.publisher.ext.ContentMathMLExtension.ContentMathMLContentHandler
- All Implemented Interfaces:
org.faceless.publisher.type.DocumentSink
,ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
,DeclHandler
,EntityResolver2
,LexicalHandler
- Enclosing class:
- ContentMathMLExtension
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a class to the currently open Element.void
Add an ID to the currently open Element.void
Add a Metadata value to the nearest scoped ancestor, or (if called before the root element), add to the root element.void
Add a state to the currently open Element, for example "disabled" or "visited".void
Add some CSS style to the currently open Element.void
addStyleListener
(org.faceless.publisher.type.StyleListener listener) Add a StyleListener to be called when the element just created with#startElement
has its style fulled defined.void
addStylesheet
(Stylesheet stylesheet, org.faceless.publisher.type.StylesheetPriority priority) Add a stylesheet to the Documentvoid
void
characters
(char[] buf, int off, int len) void
comment
(char[] ch, int start, int length) static org.faceless.publisher.type.ContentHandlerWrapper
static org.faceless.publisher.type.ContentHandlerWrapper
createParameterExtractHandler
(Appendable text, List<<any>> srclist, Map<String, String> params, Runnable task) Create a new ContentHandlerWrapper that will 1. store any text content to "text", if text !static org.faceless.publisher.type.ContentHandlerWrapper
createTextStoringHandler
(Appendable text, Runnable task, boolean echo) Create a ContentHandlerWrapper that stores any text content sent to it, passing its content to the supplied "call" event when done before removing itself.static org.faceless.publisher.type.ContentHandlerWrapper
createXMLStoringHandler
(Appendable text, Runnable task) Create a ContentHandlerWrapper that stores any XML events sent to it, passing its content to the supplied "call" event when done before removing itself.void
elementDecl
(String name, String model) void
endCDATA()
void
void
This method is called when this ContentHandler has received its final balancing endElement call.void
endDTD()
void
endElement
(String uri, String localName, String qName) void
void
endPrefixMapping
(String prefix) void
void
externalEntityDecl
(String name, String publicId, String systemId) void
org.faceless.publisher.Document
Return the Document this DocumentSink is creatingRetrieve the current Locatororg.faceless.publisher.type.DocumentSink
getExternalSubset
(String name, String baseURL) org.faceless.publisher.resource.ResourceManager
int
If ContentHandlerWrappers need to be sorted, return a rough index to sort on.Get the source, as set byContentHandlerWrapper.setSource(org.xml.sax.ContentHandler)
This isn't used internally except by insertTargetGet the target, as set byContentHandlerWrapper.setTarget(org.xml.sax.ContentHandler)
.Resolve a URL against the base URL for the currently open Elementvoid
ignorableWhitespace
(char[] ch, int start, int length) void
insertSource
(org.faceless.publisher.type.ContentHandlerWrapper t) Set the source of this object to the specified value, manipulating the source and target pointers on both classes to ensure a doubly-linked list is maintained.void
insertTarget
(org.faceless.publisher.type.ContentHandlerWrapper t) Set the target of this object to the specified value, manipulating the source and target pointers on both classes to ensure a doubly-linked list is maintained.void
internalEntityDecl
(String name, String value) void
notationDecl
(String name, String publicId, String systemId) void
processingInstruction
(String type, String data) void
remove()
Remove this ContentHandlerWrapper from a chain, by manipulating the source and target pointers on either side.resolveEntity
(String publicId, String systemId) resolveEntity
(String name, String publicId, String baseURL, String systemId) void
setBaseURL
(String uri) Set the base URL of the currently open Element.void
setColumnMembership
(org.faceless.publisher.type.ColumnMembership col) If the currently open Element is a member of a column according to the document syntax, set its ColumnMembership details.void
setDescription
(CharSequence description) Set the description on the currently open Element.void
setDirection
(boolean horizontal, boolean ltr) Set the direction of the currently open Element.void
setDocumentLocator
(Locator locator) Set the Locator describing the current parse location.void
setLanguage
(Language language) Set the language on the currently open Element.void
setReplacedContent
(org.faceless.publisher.type.ReplacedContent content) Set the replaced content of the currently open Element.void
setResourceManager
(org.faceless.publisher.resource.ResourceManager manager) void
setTarget
(ContentHandler target) Set the target.void
skippedEntity
(String name) void
void
void
void
startElement
(String uri, String localName, String qName, Attributes atts) void
startEntity
(String name) void
Start a new Element in the document.void
startPrefixMapping
(String prefix, String uri) void
unparsedEntityDecl
(String name, String publicId, String systemId, String notationName) void
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Method Details
-
startDocument
- Specified by:
startDocument
in interfaceContentHandler
- Throws:
SAXException
-
endDocument
- Specified by:
endDocument
in interfaceContentHandler
- Throws:
SAXException
-
startElement
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException - Specified by:
startElement
in interfaceContentHandler
- Throws:
SAXException
-
endElement
- Specified by:
endElement
in interfaceContentHandler
- Throws:
SAXException
-
characters
- Specified by:
characters
in interfaceContentHandler
- Throws:
SAXException
-
startPrefixMapping
- Specified by:
startPrefixMapping
in interfaceContentHandler
- Throws:
SAXException
-
endPrefixMapping
- Specified by:
endPrefixMapping
in interfaceContentHandler
- Throws:
SAXException
-
getSortKey
public int getSortKey()If ContentHandlerWrappers need to be sorted, return a rough index to sort on. The default value is 0 but can be overridden, with lower numbers put near the start of the list and higher near the end. -
getSource
Get the source, as set byContentHandlerWrapper.setSource(org.xml.sax.ContentHandler)
This isn't used internally except by insertTarget -
getTarget
Get the target, as set byContentHandlerWrapper.setTarget(org.xml.sax.ContentHandler)
. Any events passed to this class will be forwarded to the target -
setTarget
Set the target. -
insertTarget
public void insertTarget(org.faceless.publisher.type.ContentHandlerWrapper t) Set the target of this object to the specified value, manipulating the source and target pointers on both classes to ensure a doubly-linked list is maintained. -
insertSource
public void insertSource(org.faceless.publisher.type.ContentHandlerWrapper t) Set the source of this object to the specified value, manipulating the source and target pointers on both classes to ensure a doubly-linked list is maintained. -
remove
public void remove()Remove this ContentHandlerWrapper from a chain, by manipulating the source and target pointers on either side. -
getContentHandler
-
getDTDHandler
-
getEntityResolver
-
getErrorHandler
-
getLexicalHandler
-
getDeclHandler
-
getDocumentSink
public org.faceless.publisher.type.DocumentSink getDocumentSink() -
setDocumentLocator
Set the Locator describing the current parse location. A copy of this locator is given to each node when it's created, but it's only used for error reporting and is not used for relative URLs etc.- Specified by:
setDocumentLocator
in interfaceContentHandler
- Specified by:
setDocumentLocator
in interfaceorg.faceless.publisher.type.DocumentSink
-
skippedEntity
- Specified by:
skippedEntity
in interfaceContentHandler
- Throws:
SAXException
-
ignorableWhitespace
- Specified by:
ignorableWhitespace
in interfaceContentHandler
- Throws:
SAXException
-
processingInstruction
- Specified by:
processingInstruction
in interfaceContentHandler
- Throws:
SAXException
-
error
- Specified by:
error
in interfaceErrorHandler
- Throws:
SAXException
-
fatalError
- Specified by:
fatalError
in interfaceErrorHandler
- Throws:
SAXException
-
warning
- Specified by:
warning
in interfaceErrorHandler
- Throws:
SAXException
-
resolveEntity
- Specified by:
resolveEntity
in interfaceEntityResolver
- Throws:
SAXException
IOException
-
notationDecl
- Specified by:
notationDecl
in interfaceDTDHandler
- Throws:
SAXException
-
unparsedEntityDecl
public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException - Specified by:
unparsedEntityDecl
in interfaceDTDHandler
- Throws:
SAXException
-
attributeDecl
public void attributeDecl(String eName, String aName, String type, String mode, String value) throws SAXException - Specified by:
attributeDecl
in interfaceDeclHandler
- Throws:
SAXException
-
elementDecl
- Specified by:
elementDecl
in interfaceDeclHandler
- Throws:
SAXException
-
externalEntityDecl
- Specified by:
externalEntityDecl
in interfaceDeclHandler
- Throws:
SAXException
-
internalEntityDecl
- Specified by:
internalEntityDecl
in interfaceDeclHandler
- Throws:
SAXException
-
comment
- Specified by:
comment
in interfaceLexicalHandler
- Throws:
SAXException
-
endCDATA
- Specified by:
endCDATA
in interfaceLexicalHandler
- Throws:
SAXException
-
endDTD
- Specified by:
endDTD
in interfaceLexicalHandler
- Throws:
SAXException
-
startEntity
- Specified by:
startEntity
in interfaceLexicalHandler
- Throws:
SAXException
-
endEntity
- Specified by:
endEntity
in interfaceLexicalHandler
- Throws:
SAXException
-
startCDATA
- Specified by:
startCDATA
in interfaceLexicalHandler
- Throws:
SAXException
-
startDTD
- Specified by:
startDTD
in interfaceLexicalHandler
- Throws:
SAXException
-
getExternalSubset
- Specified by:
getExternalSubset
in interfaceEntityResolver2
- Throws:
SAXException
IOException
-
resolveEntity
public InputSource resolveEntity(String name, String publicId, String baseURL, String systemId) throws SAXException, IOException - Specified by:
resolveEntity
in interfaceEntityResolver2
- Throws:
SAXException
IOException
-
endDocumentFragment
This method is called when this ContentHandler has received its final balancing endElement call. By default it's a no-op- Throws:
SAXException
-
startHandledElement
public void startHandledElement()Start a new Element in the document.- Specified by:
startHandledElement
in interfaceorg.faceless.publisher.type.DocumentSink
-
getDocument
public org.faceless.publisher.Document getDocument()Return the Document this DocumentSink is creating- Specified by:
getDocument
in interfaceorg.faceless.publisher.type.DocumentSink
-
getDocumentLocator
Retrieve the current Locator- Specified by:
getDocumentLocator
in interfaceorg.faceless.publisher.type.DocumentSink
-
getResourceManager
public org.faceless.publisher.resource.ResourceManager getResourceManager()- Specified by:
getResourceManager
in interfaceorg.faceless.publisher.type.DocumentSink
-
setResourceManager
public void setResourceManager(org.faceless.publisher.resource.ResourceManager manager) - Specified by:
setResourceManager
in interfaceorg.faceless.publisher.type.DocumentSink
-
addStyle
Add some CSS style to the currently open Element. Must be called after startElement and before characters or endElement.- Specified by:
addStyle
in interfaceorg.faceless.publisher.type.DocumentSink
priority
- the priority of the style
-
addMetadata
Add a Metadata value to the nearest scoped ancestor, or (if called before the root element), add to the root element.- Specified by:
addMetadata
in interfaceorg.faceless.publisher.type.DocumentSink
- Parameters:
subject
- the subject of the metadata triple, or null for the scoped item (the most common value)property
- the propertyvalue
- the value, either a URL or
-
addStylesheet
public void addStylesheet(Stylesheet stylesheet, org.faceless.publisher.type.StylesheetPriority priority) Add a stylesheet to the Document- Specified by:
addStylesheet
in interfaceorg.faceless.publisher.type.DocumentSink
- Parameters:
stylesheet
- the stylesheetpriority
- the priority of the style
-
addID
Add an ID to the currently open Element. Must be called after startElement and before characters or endElement.- Specified by:
addID
in interfaceorg.faceless.publisher.type.DocumentSink
-
addClass
Add a class to the currently open Element. Must be called after startElement and before characters or endElement.- Specified by:
addClass
in interfaceorg.faceless.publisher.type.DocumentSink
-
addState
Add a state to the currently open Element, for example "disabled" or "visited". Must be called after startElement and before characters or endElement.- Specified by:
addState
in interfaceorg.faceless.publisher.type.DocumentSink
-
setColumnMembership
public void setColumnMembership(org.faceless.publisher.type.ColumnMembership col) If the currently open Element is a member of a column according to the document syntax, set its ColumnMembership details. Must be called after startElement and before characters or endElement.- Specified by:
setColumnMembership
in interfaceorg.faceless.publisher.type.DocumentSink
-
setLanguage
Set the language on the currently open Element. Must be called after startElement and before characters or endElement.- Specified by:
setLanguage
in interfaceorg.faceless.publisher.type.DocumentSink
- Parameters:
language
- the BCP47 language code, eg "en" or "en_GB" or "en_GB.Yorkshire"
-
setDescription
Set the description on the currently open Element. This is the description used for accessibility.- Specified by:
setDescription
in interfaceorg.faceless.publisher.type.DocumentSink
-
getDescription
- Specified by:
getDescription
in interfaceorg.faceless.publisher.type.DocumentSink
-
setBaseURL
Set the base URL of the currently open Element. Must be called after startElement and before characters or endElement.- Specified by:
setBaseURL
in interfaceorg.faceless.publisher.type.DocumentSink
- Parameters:
uri
- the URL, which may be relative to the parent (or documents) base URL
-
setDirection
public void setDirection(boolean horizontal, boolean ltr) Set the direction of the currently open Element. Must be called after startElement and before characters or endElement.- Specified by:
setDirection
in interfaceorg.faceless.publisher.type.DocumentSink
- Parameters:
horizontal
- true if the element is horizontalltr
- true if the element is left-to-right (or top-to-bottom)
-
setReplacedContent
public void setReplacedContent(org.faceless.publisher.type.ReplacedContent content) Set the replaced content of the currently open Element. Must be called after startElement and before characters or endElement.- Specified by:
setReplacedContent
in interfaceorg.faceless.publisher.type.DocumentSink
- Parameters:
content
- the ReplacedContent for this element.
-
getURL
Resolve a URL against the base URL for the currently open Element- Specified by:
getURL
in interfaceorg.faceless.publisher.type.DocumentSink
- Parameters:
uri
- the URL- Returns:
- a fully resolved absolute URL, or null if it's invalid.
-
addStyleListener
public void addStyleListener(org.faceless.publisher.type.StyleListener listener) Add a StyleListener to be called when the element just created with#startElement
has its style fulled defined. Must be called after startElement and before characters or endElement.- Specified by:
addStyleListener
in interfaceorg.faceless.publisher.type.DocumentSink
- Parameters:
listener
- the StyleListener to call
-
create
-
createXMLStoringHandler
public static org.faceless.publisher.type.ContentHandlerWrapper createXMLStoringHandler(Appendable text, Runnable task) Create a ContentHandlerWrapper that stores any XML events sent to it, passing its content to the supplied "call" event when done before removing itself. -
createTextStoringHandler
public static org.faceless.publisher.type.ContentHandlerWrapper createTextStoringHandler(Appendable text, Runnable task, boolean echo) Create a ContentHandlerWrapper that stores any text content sent to it, passing its content to the supplied "call" event when done before removing itself. Nothing is passed through to the next target. -
createParameterExtractHandler
public static org.faceless.publisher.type.ContentHandlerWrapper createParameterExtractHandler(Appendable text, List<<any>> srclist, Map<String, String> params, Runnable task) Create a new ContentHandlerWrapper that will 1. store any text content to "text", if text != null 2. extract and isolate any "source" children in "srclist", if srclist != null 3. extract and isolate any "param" children in "params", if params != null 4. call callable when done and remove itself from the chain otherwise passes everything through
-