|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
com.lowagie.text.xml.SAXiTextHandler
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 | |
(package private) float |
bottomMargin
current margin of a page. |
protected int |
chapters
Counts the number of chapters in this document. |
protected boolean |
controlOpenClose
This is a flag that can be set, if you want to open and close the Document-object yourself. |
protected Chunk |
currentChunk
This is the current chunk to which characters can be added. |
protected DocListener |
document
This is the resulting document. |
protected boolean |
ignore
This is the current chunk to which characters can be added. |
(package private) float |
leftMargin
current margin of a page. |
(package private) float |
rightMargin
current margin of a page. |
protected Stack |
stack
This is a Stack of objects, waiting to be added to the
document. |
(package private) float |
topMargin
current margin of a page. |
Constructor Summary | |
SAXiTextHandler(DocListener document)
Constructs a new SAXiTextHandler that will translate all the events triggered by the parser to actions on the Document
-object. |
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. |
protected boolean |
isDocumentRoot(String tag)
Checks if a certain tag corresponds with the roottag. |
private boolean |
isNewline(String tag)
Checks if a certain tag corresponds with the newpage-tag. |
private boolean |
isNewpage(String tag)
Checks if a certain tag corresponds with the newpage-tag. |
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,
org.xml.sax.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 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected DocListener document
protected Stack stack
Stack
of objects, waiting to be added to the
document.
protected int chapters
protected Chunk currentChunk
protected boolean ignore
protected boolean controlOpenClose
float topMargin
float rightMargin
float leftMargin
float bottomMargin
Constructor Detail |
public SAXiTextHandler(DocListener document)
Document
-object.
document
- this is the document on which events must be triggeredMethod Detail |
public void setControlOpenClose(boolean controlOpenClose)
If you set this parameter to true (= default), the parser will open the Document object when the start-root-tag is encounterd 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.
controlOpenClose
- set this to false if you plan to open/close the Document
yourselfpublic void startElement(String uri, String lname, String name, org.xml.sax.Attributes attrs)
uri
- the Uniform Resource Identifierlname
- the local name (without prefix), or the empty string if
Namespace processing is not being performed.name
- the name of the tag that is encounteredattrs
- the list of attributespublic void handleStartingTags(String name, Properties attributes)
name
- the name of the tagattributes
- the list of attributespublic void ignorableWhitespace(char[] ch, int start, int length)
ch
- an array of charactersstart
- the start position in the arraylength
- the number of characters to read from the arraypublic void characters(char[] ch, int start, int length)
ch
- an array of charactersstart
- the start position in the arraylength
- the number of characters to read from the arraypublic void endElement(String uri, String lname, String name)
uri
- the Uniform Resource Identifierlname
- the local name (without prefix), or the empty string if
Namespace processing is not being performed.name
- the name of the tag that endspublic void handleEndingTags(String name)
name
- the name of the tagprivate boolean isNewpage(String tag)
tag
- a presumed tagname
true
or false
private boolean isNewline(String tag)
tag
- a presumed tagname
true
or false
protected boolean isDocumentRoot(String tag)
tag
- a presumed tagname
true
if tag equals itext
,false
otherwise.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |