public abstract class Element extends Object
MessageMLContext.| Modifier and Type | Field and Description |
|---|---|
static String |
CLASS_ATTR |
protected FormatEnum |
format |
static String |
STYLE_ATTR |
| Modifier and Type | Method and Description |
|---|---|
void |
addChild(Element child)
Append a child to the element.
|
String |
asText()
Return a text representation of the element, descending into its children.
|
void |
buildAll(MessageMLParser context,
Element element)
Process a DOM element, descending into its children, and construct the output MessageML tree.
|
protected void |
buildNode(MessageMLParser context,
Node node)
Build a text node or a MessageML element based on the provided DOM node.
|
Integer |
countNonTextNodesInNodeList(NodeList nodeList) |
List<Element> |
findElements(Class<?> type)
Search the MessageML tree (depth-first) for elements of a given type.
|
List<Element> |
findElements(String tag)
Search the MessageML tree (depth-first) for elements with a given MessageML tag.
|
List<Element> |
findElements(String attribute,
String value)
Search the MessageML tree (depth-first) for elements with a given attribute-value pair.
|
String |
getAttribute(String attr)
Return the value of the element's attribute "attr".
|
Map<String,String> |
getAttributes()
Return a map of the element's attributes.
|
Element |
getChild(int n)
Return the nth child of the element.
|
List<Element> |
getChildren()
Return a list of the element's children.
|
FormatEnum |
getFormat()
Return the format (MessageML or PresentationML) of the element.
|
String |
getMessageMLTag()
Return the element's MessageML tag.
|
Element |
getParent()
Return the parent of the element.
|
boolean |
hasExactNumberOfChildren(int childrenNumber) |
Boolean |
hasIdAttribute()
Informs if the element has an "id" attribute.
|
int |
size()
Return the number of children of the element.
|
public static final String CLASS_ATTR
public static final String STYLE_ATTR
protected FormatEnum format
public Boolean hasIdAttribute()
public void buildAll(MessageMLParser context, Element element) throws InvalidInputException, ProcessingException
protected void buildNode(MessageMLParser context, Node node) throws InvalidInputException, ProcessingException
public String asText()
public boolean hasExactNumberOfChildren(int childrenNumber)
public String getMessageMLTag()
public String getAttribute(String attr)
public Element getChild(int n)
public void addChild(Element child)
public int size()
public Element getParent()
public FormatEnum getFormat()
public List<Element> findElements(Class<?> type)
type - the class of elements to findpublic List<Element> findElements(String tag)
tag - the MessageML tag of elements to findpublic List<Element> findElements(String attribute, String value)
attribute - the attribute name matchvalue - the attribute value to matchCopyright © 2020 The Symphony Software Foundation. All rights reserved.