Class StAXHandlerAbstract

java.lang.Object
org.docx4j.openpackaging.parts.StAXHandlerAbstract
All Implemented Interfaces:
StAXHandlerInterface

public abstract class StAXHandlerAbstract
extends java.lang.Object
implements StAXHandlerInterface
  • Constructor Summary

    Constructors 
    Constructor Description
    StAXHandlerAbstract()  
  • Method Summary

    Modifier and Type Method Description
    void handle​(javax.xml.stream.XMLStreamReader xmlr, javax.xml.stream.XMLStreamWriter xmlWriter)  
    abstract void handleCharacters​(javax.xml.stream.XMLStreamReader xmlr, javax.xml.stream.XMLStreamWriter writer)
    Implement this method; for an example, see VariableReplaceStAX sample
    void write​(javax.xml.stream.XMLStreamReader xmlr, javax.xml.stream.XMLStreamWriter writer)
    This is designed to cater for the common case of replacing character content.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • handleCharacters

      public abstract void handleCharacters​(javax.xml.stream.XMLStreamReader xmlr, javax.xml.stream.XMLStreamWriter writer) throws javax.xml.stream.XMLStreamException
      Implement this method; for an example, see VariableReplaceStAX sample
      Parameters:
      xmlr -
      writer -
      Throws:
      javax.xml.stream.XMLStreamException
    • handle

      public void handle​(javax.xml.stream.XMLStreamReader xmlr, javax.xml.stream.XMLStreamWriter xmlWriter) throws LocationAwareXMLStreamException, javax.xml.stream.XMLStreamException
      Specified by:
      handle in interface StAXHandlerInterface
      Throws:
      LocationAwareXMLStreamException
      javax.xml.stream.XMLStreamException
    • write

      public void write​(javax.xml.stream.XMLStreamReader xmlr, javax.xml.stream.XMLStreamWriter writer) throws javax.xml.stream.XMLStreamException
      This is designed to cater for the common case of replacing character content. Everything else is passed through unchanged. If you wanted to find say a w:tbl then handle it with JAXB, you'll need to override this method and handle START_ELEMENT and END_ELEMENT differently (keeping track of where you are, so they match).
      Parameters:
      xmlr -
      writer -
      Throws:
      javax.xml.stream.XMLStreamException