|
|||||||||
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.markup.Parser
public class Parser
This class allows you to parse files in a tree.
Field Summary | |
---|---|
protected int[] |
counterParents
|
protected int[] |
counters
|
protected Chunk |
currentChunk
|
protected Document |
document
|
protected Stack |
filestack
|
protected MarkupParser |
markup
|
protected Stack |
objectstack
|
protected Stack |
outline
|
protected int |
previoustitle
|
protected String[] |
structures
|
protected Stack |
tagstack
|
protected String |
title
|
protected String[] |
titles
|
protected PdfWriter |
writer
|
Constructor Summary | |
---|---|
Parser(String srcfile)
Constructs a recursive parser object. |
|
Parser(String srcfile,
String title,
String[] structures,
String[] titles,
int[] counterParents)
Constructs a recursive parser object. |
Method Summary | |
---|---|
private void |
addObject(Paragraph paragraph)
Creates a new Object and puts it on top of the objectstack. |
private void |
addObject(Phrase phrase)
Creates a new Object and puts it on top of the objectstack. |
private void |
addObject(SimpleCell cell)
Creates a new Object and puts it on top of the objectstack. |
private void |
addObject(SimpleTable table)
Creates a new Object and puts it on top of the objectstack. |
private void |
addToCurrentChunk(String s)
extending the CurrentChunk. |
void |
characters(char[] ch,
int start,
int length)
This method gets called when characters are encountered. |
void |
endElement(String uri,
String localName,
String qName)
|
private void |
flushCurrentChunk()
flushing the CurrentChunk. |
private boolean |
flushObject()
Deals with the object on top of the objectstack. |
private void |
parse()
Gets the file on top of the filestack, parses it and removes it from the stack. |
void |
processingInstruction(String instruction,
String parameter)
|
void |
startElement(String uri,
String localName,
String qName,
org.xml.sax.Attributes attributes)
|
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
---|
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, 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 Stack filestack
protected Stack outline
protected Stack tagstack
protected Stack objectstack
protected Chunk currentChunk
protected Document document
protected PdfWriter writer
protected String title
protected String[] structures
protected String[] titles
protected int[] counterParents
protected int[] counters
protected int previoustitle
protected MarkupParser markup
Constructor Detail |
---|
public Parser(String srcfile)
srcfile
- the file that has to be parsed.public Parser(String srcfile, String title, String[] structures, String[] titles, int[] counterParents)
srcfile
- the file that has to be parsedtitle
- the value of the id selector marking a titlestructures
- an array with the values of the class selectors marking titles in the complete structuretitles
- the strings that have to be added to the titlenumbercounterParents
- an array with references from each child in the structure to its parentMethod Detail |
---|
public void startElement(String uri, String localName, String qName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
public void characters(char[] ch, int start, int length)
characters
in interface org.xml.sax.ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
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 localName, String qName) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
public void processingInstruction(String instruction, String parameter) throws org.xml.sax.SAXException
processingInstruction
in interface org.xml.sax.ContentHandler
processingInstruction
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
ContentHandler.processingInstruction(java.lang.String, java.lang.String)
private void flushCurrentChunk()
private void addToCurrentChunk(String s)
s
- private void addObject(Phrase phrase)
phrase
- private void addObject(SimpleTable table)
table
- private void addObject(SimpleCell cell)
cell
- private void addObject(Paragraph paragraph)
paragraph
- private boolean flushObject()
private void parse() throws javax.xml.parsers.ParserConfigurationException, IOException, org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
IOException
org.xml.sax.SAXException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |