com.lowagie.text.pdf

Class XfdfReader

public class XfdfReader extends Object implements SimpleXMLDocHandler

Reads a XFDF.

Author: Leonard Rosenthol (leonardr@pdfsages.com)

Field Summary
StackfieldNames
HashMapfields
StackfieldValues
StringfileSpec
booleanfoundRoot
Constructor Summary
XfdfReader(String filename)
Reads an XFDF form.
XfdfReader(byte[] xfdfIn)
Reads an XFDF form.
Method Summary
voidendDocument()
Called after the document is parsed.
voidendElement(String tag)
Called when an end tag is found.
StringgetField(String name)
Gets the field value.
HashMapgetFields()
Gets all the fields.
StringgetFieldValue(String name)
Gets the field value or null if the field does not exist or has no value defined.
StringgetFileSpec()
Gets the PDF file specification contained in the FDF.
voidstartDocument()
Called when the document starts to be parsed.
voidstartElement(String tag, HashMap h)
Called when a start tag is found.
voidtext(String str)
Called when a text element is found.

Field Detail

fieldNames

private Stack fieldNames

fields

HashMap fields

fieldValues

private Stack fieldValues

fileSpec

String fileSpec

foundRoot

private boolean foundRoot

Constructor Detail

XfdfReader

public XfdfReader(String filename)
Reads an XFDF form.

Parameters: filename the file name of the form

Throws: IOException on error

XfdfReader

public XfdfReader(byte[] xfdfIn)
Reads an XFDF form.

Parameters: xfdfIn the byte array with the form

Throws: IOException on error

Method Detail

endDocument

public void endDocument()
Called after the document is parsed.

endElement

public void endElement(String tag)
Called when an end tag is found.

Parameters: tag the tag name

getField

public String getField(String name)
Gets the field value.

Parameters: name the fully qualified field name

Returns: the field's value

getFields

public HashMap getFields()
Gets all the fields. The map is keyed by the fully qualified field name and the value is a merged PdfDictionary with the field content.

Returns: all the fields

getFieldValue

public String getFieldValue(String name)
Gets the field value or null if the field does not exist or has no value defined.

Parameters: name the fully qualified field name

Returns: the field value or null

getFileSpec

public String getFileSpec()
Gets the PDF file specification contained in the FDF.

Returns: the PDF file specification contained in the FDF

startDocument

public void startDocument()
Called when the document starts to be parsed.

startElement

public void startElement(String tag, HashMap h)
Called when a start tag is found.

Parameters: tag the tag name h the tag's attributes

text

public void text(String str)
Called when a text element is found.

Parameters: str the text element, probably a fragment.