Save This Page
Home » iText-2.1.7 » com.lowagie » text » xml » [javadoc | source]
com.lowagie.text.xml
public class: SAXiTextHandler [javadoc | source]
java.lang.Object
   org.xml.sax.helpers.DefaultHandler
      com.lowagie.text.xml.SAXiTextHandler

All Implemented Interfaces:
    ErrorHandler, EntityResolver, ContentHandler, DTDHandler

Direct Known Subclasses:
    SAXmyHtmlHandler, SAXmyHandler

This class is a Handler that controls the iText XML to PDF conversion. Subclass it, if you want to change the way iText translates XML to PDF.
Field Summary
protected  DocListener document    This is the resulting document. 
protected  Stack stack    This is a Stack of objects, waiting to be added to the document. 
protected  int chapters    Counts the number of chapters in this document. 
protected  Chunk currentChunk    This is the current chunk to which characters can be added. 
protected  boolean ignore    This is the current chunk to which characters can be added. 
protected  boolean controlOpenClose    This is a flag that can be set, if you want to open and close the Document-object yourself. 
 float topMargin    current margin of a page. 
 float rightMargin    current margin of a page. 
 float leftMargin    current margin of a page. 
 float bottomMargin    current margin of a page. 
protected  HashMap myTags    This hashmap contains all the custom keys and peers. 
Constructor:
 public SAXiTextHandler(DocListener document) 
    Parameters:
    document -
 public SAXiTextHandler(DocListener document,
    HtmlTagMap myTags) 
    Parameters:
    document -
    myTags -
 public SAXiTextHandler(DocListener document,
    HashMap myTags) 
    Parameters:
    document -
    myTags -
 public SAXiTextHandler(DocListener document,
    HtmlTagMap myTags,
    BaseFont bf) 
    Parameters:
    document -
    myTags -
    bf -
Method from com.lowagie.text.xml.SAXiTextHandler Summary:
addImage,   characters,   endElement,   handleEndingTags,   handleStartingTags,   ignorableWhitespace,   isDocumentRoot,   setBaseFont,   setControlOpenClose,   startElement
Methods from org.xml.sax.helpers.DefaultHandler:
characters,   endDocument,   endElement,   endPrefixMapping,   error,   fatalError,   ignorableWhitespace,   notationDecl,   processingInstruction,   resolveEntity,   setDocumentLocator,   skippedEntity,   startDocument,   startElement,   startPrefixMapping,   unparsedEntityDecl,   warning
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.lowagie.text.xml.SAXiTextHandler Detail:
 protected  void addImage(Image img) throws EmptyStackException 
 public  void characters(char[] ch,
    int start,
    int length) 
    This method gets called when characters are encountered.
 public  void endElement(String uri,
    String lname,
    String name) 
    This method gets called when an end tag is encountered.
 public  void handleEndingTags(String name) 
    This method deals with the starting tags.
 public  void handleStartingTags(String name,
    Properties attributes) 
    This method deals with the starting tags.
 public  void ignorableWhitespace(char[] ch,
    int start,
    int length) 
    This method gets called when ignorable white space encountered.
 protected boolean isDocumentRoot(String tag) 
    Checks if a certain tag corresponds with the roottag.
 public  void setBaseFont(BaseFont bf) 
    Sets the font that has to be used.
 public  void setControlOpenClose(boolean controlOpenClose) 
    Sets the parameter that allows you to enable/disable the control over the Document.open() and Document.close() method.

    If you set this parameter to true (= default), the parser will open the Document object when the start-root-tag is encountered and close it when the end-root-tag is met. If you set it to false, you have to open and close the Document object yourself.

 public  void startElement(String uri,
    String lname,
    String name,
    Attributes attrs) 
    This method gets called when a start tag is encountered.