com.lowagie.text.xml
Class SAXiTextHandler

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended bycom.lowagie.text.xml.SAXiTextHandler
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler
Direct Known Subclasses:
SAXmyHandler, SAXmyHtmlHandler

public class SAXiTextHandler
extends DefaultHandler

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.


Constructor Summary
SAXiTextHandler(DocListener document)
           
SAXiTextHandler(DocListener document, HashMap myTags)
           
SAXiTextHandler(DocListener document, HtmlTagMap myTags)
           
SAXiTextHandler(DocListener document, HtmlTagMap myTags, BaseFont bf)
           
 
Method Summary
 void characters(char[] ch, int start, int length)
          This method gets called when characters are encountered.
 void endElement(String uri, String lname, String name)
          This method gets called when an end tag is encountered.
 void handleEndingTags(String name)
          This method deals with the starting tags.
 void handleStartingTags(String name, Properties attributes)
          This method deals with the starting tags.
 void ignorableWhitespace(char[] ch, int start, int length)
          This method gets called when ignorable white space encountered.
 void setBaseFont(BaseFont bf)
          Sets the font that has to be used.
 void setControlOpenClose(boolean controlOpenClose)
          Sets the parameter that allows you to enable/disable the control over the Document.open() and Document.close() method.
 void startElement(String uri, String lname, String name, Attributes attrs)
          This method gets called when a start tag is encountered.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAXiTextHandler

public SAXiTextHandler(DocListener document)
Parameters:
document -

SAXiTextHandler

public SAXiTextHandler(DocListener document,
                       HtmlTagMap myTags)
Parameters:
document -
myTags -

SAXiTextHandler

public SAXiTextHandler(DocListener document,
                       HtmlTagMap myTags,
                       BaseFont bf)
Parameters:
document -
myTags -
bf -

SAXiTextHandler

public SAXiTextHandler(DocListener document,
                       HashMap myTags)
Parameters:
document -
myTags -
Method Detail

setControlOpenClose

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.

Parameters:
controlOpenClose - set this to false if you plan to open/close the Document yourself

startElement

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

Parameters:
uri - the Uniform Resource Identifier
lname - the local name (without prefix), or the empty string if Namespace processing is not being performed.
name - the name of the tag that is encountered
attrs - the list of attributes

handleStartingTags

public void handleStartingTags(String name,
                               Properties attributes)
This method deals with the starting tags.

Parameters:
name - the name of the tag
attributes - the list of attributes

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
This method gets called when ignorable white space encountered.

Parameters:
ch - an array of characters
start - the start position in the array
length - the number of characters to read from the array

characters

public void characters(char[] ch,
                       int start,
                       int length)
This method gets called when characters are encountered.

Parameters:
ch - an array of characters
start - the start position in the array
length - the number of characters to read from the array

setBaseFont

public void setBaseFont(BaseFont bf)
Sets the font that has to be used.

Parameters:
bf -

endElement

public void endElement(String uri,
                       String lname,
                       String name)
This method gets called when an end tag is encountered.

Parameters:
uri - the Uniform Resource Identifier
lname - the local name (without prefix), or the empty string if Namespace processing is not being performed.
name - the name of the tag that ends

handleEndingTags

public void handleEndingTags(String name)
This method deals with the starting tags.

Parameters:
name - the name of the tag


Copyright © 2011 EGIZ - E-Government Innovation Center. All Rights Reserved.