DomElement data type
Value range of the DomElement data type
Several FirstSpirit input components store values structured in XML markup language. This is necessary as several contents can contain special markups, highlighting and information for specific parts.
In order to output or further process the contents stored in this way these input components return an object of the data type DomElement .
For further information on the DomElement data type, see API documentation: de.espirit.firstspirit.access.editor.value.DomElement
Definition using the standard input components
Different input components can be defined in the form area of a page or section template. These form elements can then be used to insert the actual editorial contents into the page. The Standard input components supported by FirstSpirit return different data types.
The following standard input components return an object of data type DomElement :
Then, with the help of a $CMS_VALUE(...)$ instruction, methods can then be applied to this object:
$CMS_VALUE(IDENTIFIER.METHOD)$
Under IDENTIFIER , the resultname parameter, defined in the input component, must be specified.
Methods on DomElement objects
The table below lists all methods which can be invoked on objects of data type DomElement .
The object is generated by the following form objects: |
---|
CMS_INPUT_DOM |
addChangeListener(ValueChangeListener)
Method name | Return type | Available since |
---|---|---|
addChangeListener(ValueChangeListener) | void |
adopt(DomElement)
Method name | Return type | Available since |
---|---|---|
adopt(DomElement) | void |
compareTo(Comparable)
Method name | Return type | Available since |
---|---|---|
compareTo(Comparable) | int |
diff(Element)
Method name | Return type | Available since |
---|---|---|
diff(Element) | Element |
equals(Object)
Method name | Return type | Available since |
---|---|---|
equals(Object) | boolean |
get
Method name | Return type | Available since |
---|---|---|
get | Element |
getClass
The .getClass() (in Bean syntax: .class) method returns the class of the invoking object (cf. java.lang.Class).
Invocation:
$CMS_VALUE(myString.class)$
$CMS_VALUE(myString.getClass())$
Output:
java.lang.String
Method name | Return type | Available since |
---|---|---|
getClass | Class |
getRoot
Method name | Return type | Available since |
---|---|---|
getRoot | DefaultDomNode |
isCase(Object)
Method name | Return type | Available since |
---|---|---|
isCase(Object) | boolean |
isEmpty
The .isEmpty() (in Bean syntax: .isEmpty) method checks whether an expression or object is empty, e.g. storeElement.isEmpty(). The result of the semantic check depends on the expression or object, e.g. a character string is empty if it does not contain any characters. In the case of objects with complex values or objects, the object decides when it is empty. The data type DomElement for example always contains an empty document, thus it is never null. For this reason, checking an empty DOM editor input component by using the method .isNull() returns the value false, whereas checking the component with .isEmpty() would return the value true.
The method .isEmpty() returns a Boolean value as the check result. true is the check result if the expression or object is empty and false if not.
Method name | Return type | Available since |
---|---|---|
isEmpty | boolean |
isNull
The .isNull() (in Bean syntax: .isNull) method checks whether an expression or object is null , e.g. storeElement.isNull(). In the case of objects with complex values or objects, the object decides when it is null. The data type DomElement for example always contains an empty document, thus it is never null. For this reason, checking an empty DOM editor input component by using the method .isNull() returns the value false, whereas checking the component with .isEmpty() would return the value true.
The method .isNull() returns a Boolean value as the check result. true is the check result if the expression or object is null and false if not.
Method name | Return type | Available since |
---|---|---|
isNull | boolean |
normalize
In addition to inserting and formatting continuous text, the CMS_INPUT_DOM input component can also be used to generate and maintain lists and tables.
The content of a DOM editor is structured in paragraphs. A paragraph is displayed using a format template. This must be a "section format template" ("section formatting", see the Format templates page in the Basics section). In addition to the display in the editor, this format template also defines how the content that is identified in the DOM editor with this format template is output. In the event that
- the editor has not selected a specific format template or
- no section format template has been defined in the form using the FORMATS / TEMPLATE tags,
the "Default" format template should generally be used. By default, the content is output using <p> tags that enclose the content of a section in the DOM editor, for example:
<p>This is <b>formatted</b> text.</p>
However, other tags may be used depending on the format template that has been selected.
Inputs and outputs for lists and tables are also controlled using the selected section format template. If the "Default" format template is selected for a list or table, the output is also enclosed by <p> tags by default.
As a <p> element is a block element, it cannot contain any more block elements (lists, tables) in accordance with the HTML specification. However, from FirstSpirit version 5.1R3, the .normalize method can be used to configure the output of CMS_INPUT_DOM so that lists and tables are not enclosed by other tags that are generated by the section format template valid for the list or table.
Example:
$CMS_VALUE(pt_dom.normalize)$
pt_dom is the identifier for a CMS_INPUT_DOM input component.
If .normalize is not used, lists and tables in the HTML output may be enclosed by tags that come from the selected section format template, for example:
<p>Continuous text</p>
<p>Continuous text</p>
<p>
<ul>
<li>List element 1</li>
<li>List element 2</li>
<li>List element 3</li>
</ul>
</p>
<p>Continuous text</p>
If .normalize is used, lists and tables in the output are not enclosed by tags that come from the selected section format template, for example:
<p>Continuous text</p>
<p>Continuous text</p>
<ul>
<li>List element 1</li>
<li>List element 2</li>
<li>List element 3</li>
</ul>
<p>Continuous text</p>
Method name | Return type | Available since |
---|---|---|
normalize | DomElement | 5.1.300 |
parseHtml(String)
Method name | Return type | Available since |
---|---|---|
parseHtml(String) | void |
Method name | Return type | Available since |
---|---|---|
void |
removeChangeListener(ValueChangeListener)
Method name | Return type | Available since |
---|---|---|
removeChangeListener(ValueChangeListener) | void |
renderToString
The .renderToString() (in Bean syntax: .renderToString) method outputs a DOM element as a character string. This is necessary as the data is stored, e.g. in the input component DOM structured as XML. Then the XML of the input component is rendered the individual format templates are then applied.
The content of a DOM element can potentially be very large. Further, many format templates can be used in the rendering. Both are very calculation-intensive and therefore the renderToString method should only be used in exceptional cases. |
Method name | Return type | Available since |
---|---|---|
renderToString | String | 4.0.0 |
set(Element)
Method name | Return type | Available since |
---|---|---|
set(Element) | void |
set(String)
Method name | Return type | Available since |
---|---|---|
set(String) | void |
set(String, Object)
Method name | Return type | Available since |
---|---|---|
set(String, Object) | Object |
toJson
Convert to JSON string representtion (only handles Maps, Collections, Arrays, Numbers, and Strings)Method name | Return type | Available since |
---|---|---|
toJson | String | 4.2.14 |
toString
Method name | Return type | Available since |
---|---|---|
toString | String |
toText(boolean)
Method name | Return type | Available since |
---|---|---|
toText(boolean) | String |
type
Method name | Return type | Available since |
---|---|---|
type | String |