public class FormParser extends Object
Modifier and Type | Class and Description |
---|---|
static class |
FormParser.RichTextPrefixResolver
XML prefix resolver which declares docbook and html namespaces.
|
Modifier and Type | Field and Description |
---|---|
private static Logger |
__LOGGER |
protected static String |
_CAPTCHA_ELEMENT
The captcha XML element name.
|
protected static String |
_FIELDSET_ELEMENT
The fieldset XML element name.
|
protected static String |
_INPUT_ELEMENT
The input XML element name.
|
protected static String |
_LABEL_ELEMENT
The label XML element name.
|
protected static String |
_LEGEND_ELEMENT
The fieldset XML element name.
|
protected static String |
_OPTION_ELEMENT
The option XML element name.
|
protected static String |
_SELECT_ELEMENT
The select XML element name.
|
protected static String |
_TEXTAREA_ELEMENT
The textarea XML element name.
|
protected XPathProcessor |
_xpathProcessor
An XPath processor.
|
static PrefixResolver |
RICH_TEXT_PREFIX_RESOLVER
The rich text prefix resolver.
|
Constructor and Description |
---|
FormParser(XPathProcessor xpathProcessor)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
String |
_getAttribute(Node node,
String attributeName)
Return the value of an attribute of an input
|
protected Field.FieldType |
_getInputType(Node inputNode)
Get the input type.
|
protected void |
_parseFields(Node formNode,
Form form)
Parse the fields of a form.
|
protected void |
_processAttributes(Node node,
Field field)
Process common field attributes and properties.
|
protected Field |
_processCaptcha(Node captchaNode)
Process a captcha.
|
protected Fieldset |
_processFieldset(Node fieldsetNode)
Process a fieldset.
|
protected Field |
_processInput(Node inputNode)
Process an input.
|
protected void |
_processLabel(Node labelNode,
Map<String,String> labels)
Process a label.
|
protected Field |
_processSelect(Node selectNode)
Process a select.
|
protected Field |
_processTextarea(Node textareaNode)
Process an textarea.
|
List<Node> |
getNodesAsList(Node context,
String xpathExpression)
Return a list of nodes selected by an xpath expression.
|
Form |
parseForm(Node formNode)
Parses the form.
|
public static final PrefixResolver RICH_TEXT_PREFIX_RESOLVER
protected static final String _LABEL_ELEMENT
protected static final String _INPUT_ELEMENT
protected static final String _TEXTAREA_ELEMENT
protected static final String _SELECT_ELEMENT
protected static final String _OPTION_ELEMENT
protected static final String _CAPTCHA_ELEMENT
protected static final String _FIELDSET_ELEMENT
protected static final String _LEGEND_ELEMENT
protected XPathProcessor _xpathProcessor
public FormParser(XPathProcessor xpathProcessor)
xpathProcessor
- the xpath processorpublic List<Node> getNodesAsList(Node context, String xpathExpression)
context
- the context node.xpathExpression
- the expression used to select nodes.public Form parseForm(Node formNode)
formNode
- the node to parse (must be a node <html:form type="cms">)public String _getAttribute(Node node, String attributeName)
node
- the nodeattributeName
- the name of the attributeprotected void _parseFields(Node formNode, Form form)
formNode
- the form node.form
- the form object.protected Fieldset _processFieldset(Node fieldsetNode)
fieldsetNode
- the fielset DOM node.protected void _processLabel(Node labelNode, Map<String,String> labels)
labelNode
- the label DOM node.labels
- the label map.protected Field _processInput(Node inputNode)
inputNode
- the input DOM node.protected Field _processTextarea(Node textareaNode)
textareaNode
- the textarea DOM node.protected Field _processSelect(Node selectNode)
selectNode
- the select DOM node.protected Field _processCaptcha(Node captchaNode)
captchaNode
- the captcha DOM node.protected Field.FieldType _getInputType(Node inputNode)
inputNode
- the input node.protected void _processAttributes(Node node, Field field)
node
- the field node.field
- the field object to fill.