Class Node
java.lang.Object
org.exoplatform.social.common.xmlprocessor.model.Node
Model of XML node tree
- Author:
- Ly Minh Phuong - http://phuonglm.net
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(String key, String value) Adds Attribute to current Node.voidaddChildNode(Node childNode) Adds child Node to this Node.voidConverts this Tag Node to Content Node, add Close Tag at the end of child nodes and move all child Nodes of this Node to parent Node.Returns Attributes of NodeGets the list child nodes of current Node.Gets the Content of Node, if Node have Content it mean that is text Node.Gets parent Node of current Node.getTitle()Gets title of Node, node's title ak the tag name.voidinsertAfter(int position, Node node) Insert Node to DOM tree after the node at positionvoidinsertAfter(Node refNode, Node nodeToInsert) insert Node to DOM tree after refNodebooleanCheck if node is RootNodebooleanCheck if node is SelfCloseNodebooleanCheck if node is TextNodevoidsetAttributes(Attributes attributes) Sets attributes of Node.voidsetChildNodes(LinkedList<Node> childNodes) Sets the list child nodes of current Node.voidsetContent(String content) Sets the Content of Node, if Node have Content it mean that is text Node.voidsetParentNode(Node parentNode) Sets the parent Node of currentNodevoidSets title of Node, node's title ak the tag name.toString()Convert Node to XML String including all sub-Node
-
Constructor Details
-
Node
public Node()
-
-
Method Details
-
getParentNode
Gets parent Node of current Node. If current Node is root, parent Node == null;- Returns:
- parent node
-
setParentNode
Sets the parent Node of currentNode- Parameters:
parentNode-
-
getTitle
Gets title of Node, node's title ak the tag name.- Returns:
- the node title
-
setTitle
Sets title of Node, node's title ak the tag name.- Parameters:
nodeTitle-
-
getAttributes
Returns Attributes of Node- Returns:
- the attributes
-
setAttributes
Sets attributes of Node.- Parameters:
attributes-
-
getContent
Gets the Content of Node, if Node have Content it mean that is text Node.- Returns:
- the content node
-
setContent
Sets the Content of Node, if Node have Content it mean that is text Node.- Parameters:
content-
-
getChildNodes
Gets the list child nodes of current Node.- Returns:
- child nodes
-
setChildNodes
Sets the list child nodes of current Node.- Parameters:
childNodes- the child nodes
-
addChildNode
Adds child Node to this Node.- Parameters:
childNode- the child node
-
addAttribute
Adds Attribute to current Node.- Parameters:
key- attribute keyvalue- attribute value
-
isTextNode
public boolean isTextNode()Check if node is TextNode- Returns:
- Since:
- 1.2.2
-
isRootNode
public boolean isRootNode()Check if node is RootNode- Returns:
- Since:
- 1.2.2
-
isSelfClosedNode
public boolean isSelfClosedNode()Check if node is SelfCloseNode- Returns:
- Since:
- 1.2.2
-
insertAfter
insert Node to DOM tree after refNode- Parameters:
refNode-nodeToInsert-- Since:
- 1.2.2
-
insertAfter
Insert Node to DOM tree after the node at position- Parameters:
position-node-- Since:
- 1.2.2
-
toString
Convert Node to XML String including all sub-Node -
convertToContent
public void convertToContent()Converts this Tag Node to Content Node, add Close Tag at the end of child nodes and move all child Nodes of this Node to parent Node.
-