Class IFStructureTreeBuilder

  • All Implemented Interfaces:
    StructureTreeEventHandler

    final class IFStructureTreeBuilder
    extends java.lang.Object
    implements StructureTreeEventHandler
    Saves structure tree events as SAX events in order to replay them when it's time to stream the structure tree to the output.
    • Constructor Detail

      • IFStructureTreeBuilder

        IFStructureTreeBuilder()
    • Method Detail

      • replayEventsForPageSequence

        public void replayEventsForPageSequence​(org.xml.sax.ContentHandler handler,
                                                int pageSequenceIndex)
                                         throws org.xml.sax.SAXException
        Replay SAX events for a page sequence.
        Parameters:
        handler - The handler that receives SAX events
        pageSequenceIndex - The index of the page sequence
        Throws:
        org.xml.sax.SAXException
      • replayEventsForRetrievedMarkers

        public void replayEventsForRetrievedMarkers​(org.xml.sax.ContentHandler handler)
                                             throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • startPageSequence

        public void startPageSequence​(java.util.Locale locale,
                                      java.lang.String role)
        Description copied from interface: StructureTreeEventHandler
        Starts a page sequence structure tree node.
        Specified by:
        startPageSequence in interface StructureTreeEventHandler
        Parameters:
        locale - The locale of the page sequence
        role - the value of the role property. May be null.
      • prepareRetrievedMarkersEventRecorder

        private void prepareRetrievedMarkersEventRecorder()
      • startNode

        public StructureTreeElement startNode​(java.lang.String name,
                                              org.xml.sax.Attributes attributes,
                                              StructureTreeElement parent)
        Description copied from interface: StructureTreeEventHandler
        Starts a structure tree node.
        Specified by:
        startNode in interface StructureTreeEventHandler
        Parameters:
        name - the name of the structure tree node
        attributes - the node properties
        parent - the parent of the node. May be null, in which case the parent node is the node corresponding to the previous call to this method
        Returns:
        the corresponding structure tree element
      • addParentAttribute

        private org.xml.sax.helpers.AttributesImpl addParentAttribute​(org.xml.sax.helpers.AttributesImpl attributes,
                                                                      StructureTreeElement parent)
      • startImageNode

        public StructureTreeElement startImageNode​(java.lang.String name,
                                                   org.xml.sax.Attributes attributes,
                                                   StructureTreeElement parent)
        Description copied from interface: StructureTreeEventHandler
        Starts an image node.
        Specified by:
        startImageNode in interface StructureTreeEventHandler
        Parameters:
        name - the name of the structure tree node
        attributes - the node properties
        parent - the parent of the node. May be null, in which case the parent node is the node corresponding to the previous call to this method
        Returns:
        the corresponding structure tree element
      • startReferencedNode

        public StructureTreeElement startReferencedNode​(java.lang.String name,
                                                        org.xml.sax.Attributes attributes,
                                                        StructureTreeElement parent)
        Description copied from interface: StructureTreeEventHandler
        Starts a node that can be referenced by other nodes. This is usually a node that can have Marked Content References as children.
        Specified by:
        startReferencedNode in interface StructureTreeEventHandler
        Parameters:
        name - the name of the structure tree node
        attributes - the node properties
        parent - the parent of the node. May be null, in which case the parent node is the node corresponding to the previous call to this method
        Returns:
        the corresponding structure tree element
      • getNextID

        private java.lang.String getNextID()
      • addIDAttribute

        private org.xml.sax.helpers.AttributesImpl addIDAttribute​(org.xml.sax.Attributes attributes,
                                                                  java.lang.String id)