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

public static class ContentMathMLExtension.ContentMathMLContentHandler extends Object
  • Method Details

    • startDocument

      public void startDocument() throws SAXException
      Specified by:
      startDocument in interface ContentHandler
      Throws:
      SAXException
    • endDocument

      public void endDocument() throws SAXException
      Specified by:
      endDocument in interface ContentHandler
      Throws:
      SAXException
    • startElement

      public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException
      Specified by:
      startElement in interface ContentHandler
      Throws:
      SAXException
    • endElement

      public void endElement(String uri, String localName, String qName) throws SAXException
      Specified by:
      endElement in interface ContentHandler
      Throws:
      SAXException
    • characters

      public void characters(char[] buf, int off, int len) throws SAXException
      Specified by:
      characters in interface ContentHandler
      Throws:
      SAXException
    • startPrefixMapping

      public void startPrefixMapping(String prefix, String uri) throws SAXException
      Specified by:
      startPrefixMapping in interface ContentHandler
      Throws:
      SAXException
    • endPrefixMapping

      public void endPrefixMapping(String prefix) throws SAXException
      Specified by:
      endPrefixMapping in interface ContentHandler
      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

      public ContentHandler getSource()
      Get the source, as set by ContentHandlerWrapper.setSource(org.xml.sax.ContentHandler) This isn't used internally except by insertTarget
    • getTarget

      public ContentHandler getTarget()
      Get the target, as set by ContentHandlerWrapper.setTarget(org.xml.sax.ContentHandler). Any events passed to this class will be forwarded to the target
    • setTarget

      public void setTarget(ContentHandler target)
      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

      public ContentHandler getContentHandler()
    • getDTDHandler

      public DTDHandler getDTDHandler()
    • getEntityResolver

      public EntityResolver getEntityResolver()
    • getErrorHandler

      public ErrorHandler getErrorHandler()
    • getLexicalHandler

      public LexicalHandler getLexicalHandler()
    • getDeclHandler

      public DeclHandler getDeclHandler()
    • getDocumentSink

      public org.faceless.publisher.type.DocumentSink getDocumentSink()
    • setDocumentLocator

      public void setDocumentLocator(Locator locator)
      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 interface ContentHandler
      Specified by:
      setDocumentLocator in interface org.faceless.publisher.type.DocumentSink
    • skippedEntity

      public void skippedEntity(String name) throws SAXException
      Specified by:
      skippedEntity in interface ContentHandler
      Throws:
      SAXException
    • ignorableWhitespace

      public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
      Specified by:
      ignorableWhitespace in interface ContentHandler
      Throws:
      SAXException
    • processingInstruction

      public void processingInstruction(String type, String data) throws SAXException
      Specified by:
      processingInstruction in interface ContentHandler
      Throws:
      SAXException
    • error

      public void error(SAXParseException e) throws SAXException
      Specified by:
      error in interface ErrorHandler
      Throws:
      SAXException
    • fatalError

      public void fatalError(SAXParseException e) throws SAXException
      Specified by:
      fatalError in interface ErrorHandler
      Throws:
      SAXException
    • warning

      public void warning(SAXParseException e) throws SAXException
      Specified by:
      warning in interface ErrorHandler
      Throws:
      SAXException
    • resolveEntity

      public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
      Specified by:
      resolveEntity in interface EntityResolver
      Throws:
      SAXException
      IOException
    • notationDecl

      public void notationDecl(String name, String publicId, String systemId) throws SAXException
      Specified by:
      notationDecl in interface DTDHandler
      Throws:
      SAXException
    • unparsedEntityDecl

      public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException
      Specified by:
      unparsedEntityDecl in interface DTDHandler
      Throws:
      SAXException
    • attributeDecl

      public void attributeDecl(String eName, String aName, String type, String mode, String value) throws SAXException
      Specified by:
      attributeDecl in interface DeclHandler
      Throws:
      SAXException
    • elementDecl

      public void elementDecl(String name, String model) throws SAXException
      Specified by:
      elementDecl in interface DeclHandler
      Throws:
      SAXException
    • externalEntityDecl

      public void externalEntityDecl(String name, String publicId, String systemId) throws SAXException
      Specified by:
      externalEntityDecl in interface DeclHandler
      Throws:
      SAXException
    • internalEntityDecl

      public void internalEntityDecl(String name, String value) throws SAXException
      Specified by:
      internalEntityDecl in interface DeclHandler
      Throws:
      SAXException
    • comment

      public void comment(char[] ch, int start, int length) throws SAXException
      Specified by:
      comment in interface LexicalHandler
      Throws:
      SAXException
    • endCDATA

      public void endCDATA() throws SAXException
      Specified by:
      endCDATA in interface LexicalHandler
      Throws:
      SAXException
    • endDTD

      public void endDTD() throws SAXException
      Specified by:
      endDTD in interface LexicalHandler
      Throws:
      SAXException
    • startEntity

      public void startEntity(String name) throws SAXException
      Specified by:
      startEntity in interface LexicalHandler
      Throws:
      SAXException
    • endEntity

      public void endEntity(String name) throws SAXException
      Specified by:
      endEntity in interface LexicalHandler
      Throws:
      SAXException
    • startCDATA

      public void startCDATA() throws SAXException
      Specified by:
      startCDATA in interface LexicalHandler
      Throws:
      SAXException
    • startDTD

      public void startDTD(String name, String publicId, String systemId) throws SAXException
      Specified by:
      startDTD in interface LexicalHandler
      Throws:
      SAXException
    • getExternalSubset

      public InputSource getExternalSubset(String name, String baseURL) throws SAXException, IOException
      Specified by:
      getExternalSubset in interface EntityResolver2
      Throws:
      SAXException
      IOException
    • resolveEntity

      public InputSource resolveEntity(String name, String publicId, String baseURL, String systemId) throws SAXException, IOException
      Specified by:
      resolveEntity in interface EntityResolver2
      Throws:
      SAXException
      IOException
    • endDocumentFragment

      public void endDocumentFragment() throws SAXException
      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 interface org.faceless.publisher.type.DocumentSink
    • getDocument

      public org.faceless.publisher.Document getDocument()
      Return the Document this DocumentSink is creating
      Specified by:
      getDocument in interface org.faceless.publisher.type.DocumentSink
    • getDocumentLocator

      public Locator getDocumentLocator()
      Retrieve the current Locator
      Specified by:
      getDocumentLocator in interface org.faceless.publisher.type.DocumentSink
    • getResourceManager

      public org.faceless.publisher.resource.ResourceManager getResourceManager()
      Specified by:
      getResourceManager in interface org.faceless.publisher.type.DocumentSink
    • setResourceManager

      public void setResourceManager(org.faceless.publisher.resource.ResourceManager manager)
      Specified by:
      setResourceManager in interface org.faceless.publisher.type.DocumentSink
    • addStyle

      public void addStyle(String stylesheet, org.faceless.publisher.type.StylesheetPriority priority)
      Add some CSS style to the currently open Element. Must be called after startElement and before characters or endElement.
      Specified by:
      addStyle in interface org.faceless.publisher.type.DocumentSink
      priority - the priority of the style
    • addMetadata

      public void addMetadata(URL2 subject, URL2 property, Object value, Language lang, Object source)
      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 interface org.faceless.publisher.type.DocumentSink
      Parameters:
      subject - the subject of the metadata triple, or null for the scoped item (the most common value)
      property - the property
      value - 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 interface org.faceless.publisher.type.DocumentSink
      Parameters:
      stylesheet - the stylesheet
      priority - the priority of the style
    • addID

      public void addID(String id)
      Add an ID to the currently open Element. Must be called after startElement and before characters or endElement.
      Specified by:
      addID in interface org.faceless.publisher.type.DocumentSink
    • addClass

      public void addClass(String clazz)
      Add a class to the currently open Element. Must be called after startElement and before characters or endElement.
      Specified by:
      addClass in interface org.faceless.publisher.type.DocumentSink
    • addState

      public void addState(String state)
      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 interface org.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 interface org.faceless.publisher.type.DocumentSink
    • setLanguage

      public void setLanguage(Language language)
      Set the language on the currently open Element. Must be called after startElement and before characters or endElement.
      Specified by:
      setLanguage in interface org.faceless.publisher.type.DocumentSink
      Parameters:
      language - the BCP47 language code, eg "en" or "en_GB" or "en_GB.Yorkshire"
    • setDescription

      public void setDescription(CharSequence description)
      Set the description on the currently open Element. This is the description used for accessibility.
      Specified by:
      setDescription in interface org.faceless.publisher.type.DocumentSink
    • getDescription

      public CharSequence getDescription()
      Specified by:
      getDescription in interface org.faceless.publisher.type.DocumentSink
    • setBaseURL

      public void setBaseURL(String uri)
      Set the base URL of the currently open Element. Must be called after startElement and before characters or endElement.
      Specified by:
      setBaseURL in interface org.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 interface org.faceless.publisher.type.DocumentSink
      Parameters:
      horizontal - true if the element is horizontal
      ltr - 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 interface org.faceless.publisher.type.DocumentSink
      Parameters:
      content - the ReplacedContent for this element.
    • getURL

      public URL2 getURL(String uri)
      Resolve a URL against the base URL for the currently open Element
      Specified by:
      getURL in interface org.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 interface org.faceless.publisher.type.DocumentSink
      Parameters:
      listener - the StyleListener to call
    • create

      public static org.faceless.publisher.type.ContentHandlerWrapper create(XMLFilter filter)
    • 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