Class FormParser
java.lang.Object
org.ametys.plugins.forms.workflow.FormParser
Form parser.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
XML prefix resolver which declares docbook and html namespaces. -
Field Summary
Modifier and TypeFieldDescriptionprotected static final String
The captcha XML element name.protected static final String
The fieldset XML element name.protected static final String
The input XML element name.protected static final String
The label XML element name.protected static final String
The fieldset XML element name.protected static final String
The option XML element name.protected static final String
The select XML element name.protected static final String
The textarea XML element name.protected XPathProcessor
An XPath processor.static final PrefixResolver
The rich text prefix resolver. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription_getAttribute
(Node node, String attributeName) Return the value of an attribute of an inputprotected 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.getNodesAsList
(Node context, String xpathExpression) Return a list of nodes selected by an xpath expression.Parses the form.
-
Field Details
-
RICH_TEXT_PREFIX_RESOLVER
The rich text prefix resolver. -
_LABEL_ELEMENT
The label XML element name.- See Also:
-
_INPUT_ELEMENT
The input XML element name.- See Also:
-
_TEXTAREA_ELEMENT
The textarea XML element name.- See Also:
-
_SELECT_ELEMENT
The select XML element name.- See Also:
-
_OPTION_ELEMENT
The option XML element name.- See Also:
-
_CAPTCHA_ELEMENT
The captcha XML element name.- See Also:
-
_FIELDSET_ELEMENT
The fieldset XML element name.- See Also:
-
_LEGEND_ELEMENT
The fieldset XML element name.- See Also:
-
_xpathProcessor
An XPath processor.
-
-
Constructor Details
-
FormParser
Default constructor.- Parameters:
xpathProcessor
- the xpath processor
-
-
Method Details
-
getNodesAsList
Return a list of nodes selected by an xpath expression.- Parameters:
context
- the context node.xpathExpression
- the expression used to select nodes.- Returns:
- a list of nodes selected by an xpath expression.
-
parseForm
Parses the form.- Parameters:
formNode
- the node to parse (must be a node <html:form type="cms">)- Returns:
- the extracted Form.
-
_getAttribute
Return the value of an attribute of an input- Parameters:
node
- the nodeattributeName
- the name of the attribute- Returns:
- the value of an attribute of an input
-
_parseFields
Parse the fields of a form.- Parameters:
formNode
- the form node.form
- the form object.
-
_processFieldset
Process a fieldset.- Parameters:
fieldsetNode
- the fielset DOM node.- Returns:
- the fieldset.
-
_processLabel
Process a label.- Parameters:
labelNode
- the label DOM node.labels
- the label map.
-
_processInput
Process an input.- Parameters:
inputNode
- the input DOM node.- Returns:
- the input as a Field.
-
_processTextarea
Process an textarea.- Parameters:
textareaNode
- the textarea DOM node.- Returns:
- the textarea as a Field.
-
_processSelect
Process a select.- Parameters:
selectNode
- the select DOM node.- Returns:
- the select as a Field.
-
_processCaptcha
Process a captcha.- Parameters:
captchaNode
- the captcha DOM node.- Returns:
- the captcha as a Field.
-
_getInputType
Get the input type.- Parameters:
inputNode
- the input node.- Returns:
- the field type.
-
_processAttributes
Process common field attributes and properties.- Parameters:
node
- the field node.field
- the field object to fill.
-