Package com.aowagie.text.pdf
Class XfdfReader
- java.lang.Object
-
- com.aowagie.text.pdf.XfdfReader
-
- All Implemented Interfaces:
SimpleXMLDocHandler
class XfdfReader extends java.lang.Object implements SimpleXMLDocHandler
Reads a XFDF.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Stack
fieldNames
private java.util.HashMap
fields
private java.util.Stack
fieldValues
private java.lang.String
fileSpec
private boolean
foundRoot
private java.util.HashMap
listFields
Storage for field values if there's more than one value for a field.
-
Constructor Summary
Constructors Constructor Description XfdfReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
endDocument()
Called after the document is parsed.void
endElement(java.lang.String tag)
Called when an end tag is found.java.util.HashMap
getFields()
Gets all the fields.(package private) java.lang.String
getFieldValue(java.lang.String name)
Gets the field value ornull
if the field does not exist or has no value defined.java.lang.String
getFileSpec()
Gets the PDF file specification contained in the FDF.(package private) java.util.List
getListValues(java.lang.String name)
Gets the field values for a list ornull
if the field does not exist or has no value defined.void
startDocument()
Called when the document starts to be parsed.void
startElement(java.lang.String tag, java.util.HashMap h)
Called when a start tag is found.void
text(java.lang.String str)
Called when a text element is found.
-
-
-
Field Detail
-
foundRoot
private boolean foundRoot
-
fieldNames
private final java.util.Stack fieldNames
-
fieldValues
private final java.util.Stack fieldValues
-
fields
private java.util.HashMap fields
-
listFields
private java.util.HashMap listFields
Storage for field values if there's more than one value for a field.- Since:
- 2.1.4
-
fileSpec
private java.lang.String fileSpec
-
-
Method Detail
-
getFields
public java.util.HashMap getFields()
Gets all the fields. The map is keyed by the fully qualified field name and the value is a mergedPdfDictionary
with the field content.- Returns:
- all the fields
-
getFieldValue
java.lang.String getFieldValue(java.lang.String name)
Gets the field value ornull
if the field does not exist or has no value defined.- Parameters:
name
- the fully qualified field name- Returns:
- the field value or
null
-
getListValues
java.util.List getListValues(java.lang.String name)
Gets the field values for a list ornull
if the field does not exist or has no value defined.- Parameters:
name
- the fully qualified field name- Returns:
- the field values or
null
- Since:
- 2.1.4
-
getFileSpec
public java.lang.String getFileSpec()
Gets the PDF file specification contained in the FDF.- Returns:
- the PDF file specification contained in the FDF
-
startElement
public void startElement(java.lang.String tag, java.util.HashMap h)
Called when a start tag is found.- Specified by:
startElement
in interfaceSimpleXMLDocHandler
- Parameters:
tag
- the tag nameh
- the tag's attributes
-
endElement
public void endElement(java.lang.String tag)
Called when an end tag is found.- Specified by:
endElement
in interfaceSimpleXMLDocHandler
- Parameters:
tag
- the tag name
-
startDocument
public void startDocument()
Called when the document starts to be parsed.- Specified by:
startDocument
in interfaceSimpleXMLDocHandler
-
endDocument
public void endDocument()
Called after the document is parsed.- Specified by:
endDocument
in interfaceSimpleXMLDocHandler
-
text
public void text(java.lang.String str)
Called when a text element is found.- Specified by:
text
in interfaceSimpleXMLDocHandler
- Parameters:
str
- the text element, probably a fragment.
-
-