Class AXmlNode
java.lang.Object
soot.jimple.infoflow.android.axml.AXmlElement
soot.jimple.infoflow.android.axml.AXmlNode
Represents a node of an Android XML document.
- Author:
- Stefan Haas, Mario Schlipf
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AXmlNodeThe parent node.protected StringThe node's tag.protected StringThe textual contents of the nodeFields inherited from class soot.jimple.infoflow.android.axml.AXmlElement
added, include -
Constructor Summary
ConstructorsConstructorDescriptionCreates a newAXmlNodeobject with the giventag,namespaceandparent.
Keep in mind that this node will automatically be added as child to the given parent node withparent.addChild(this).Creates a newAXmlNodeobject with the giventag,namespaceandparent.
Keep in mind that this node will automatically be added as child to the given parent node withparent.addChild(this). -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(String key, String ns, String value) Adds the given attribute to this node.voidaddAttribute(AXmlAttribute<?> attr) Adds the given attribute to this node.Adds the given node as child.Adds the given node as child at position index.booleanaddSiblingAfter(AXmlNode sibling) Adds the given node as sibling after this node and returns true.
If this node has no parent the sibling cannot be added and false will be returned instead.booleanaddSiblingBefore(AXmlNode sibling) Adds the given node as sibling before this node and returns true.
If this node has no parent the sibling cannot be added and false will be returned instead.getAttribute(String name) Returns the attribute with the givenname.Map<String,AXmlAttribute<?>> Returns a map which contains all attributes.List containing all children of this node.getChildrenWithTag(String tag) List containing all children of this node which have the giventag.Returns the parent node.
If this node is part of a valid XML document, consider that only the root node's parent can be and has to be null.getTag()Returns the tag of this node.getText()Gets the textual contents of this nodebooleanhasAttribute(String name) Returns whether this node has an attribute with the givenname.removeAttribute(String key) Removes an element from the attributes.voidremoveChild(AXmlNode child) Remove child 'child' of this nodevoidSets the parent of this node.voidSets the textual contents of this nodetoString()Methods inherited from class soot.jimple.infoflow.android.axml.AXmlElement
exclude, getNamespace, include, include, isAdded, isIncluded, setAdded, setNamespace
-
Field Details
-
tag
The node's tag. -
text
The textual contents of the node -
parent
The parent node.
-
-
Constructor Details
-
AXmlNode
Creates a newAXmlNodeobject with the giventag,namespaceandparent.
Keep in mind that this node will automatically be added as child to the given parent node withparent.addChild(this). If you want to create a root node you can setparentto null.
Theadddedflag is defaulted to true (seeAXmlElement.added).- Parameters:
tag- the node's tag.ns- the node's namespace.parent- the node's parent node.
-
AXmlNode
Creates a newAXmlNodeobject with the giventag,namespaceandparent.
Keep in mind that this node will automatically be added as child to the given parent node withparent.addChild(this). If you want to create a root node you can setparentto null.
Theadddedflag is defaulted to true (seeAXmlElement.added).- Parameters:
tag- the node's tag.ns- the node's namespace.parent- the node's parent node.text- The textual contents of the node
-
AXmlNode
Creates a newAXmlNodeobject with the giventag,namespaceandparent. Keep in mind that this node will automatically be added as child to the given parent node withparent.addChild(this).- Parameters:
tag- the node's tag.ns- the node's namespace.parent- the node's parent node.added- wheter this node was part of a parsed xml file or added afterwards.text- The textual contents of the node
-
-
Method Details
-
getTag
Returns the tag of this node.- Returns:
- the node's tag
-
addSiblingBefore
Adds the given node as sibling before this node and returns true.
If this node has no parent the sibling cannot be added and false will be returned instead.- Parameters:
sibling-- Returns:
- false if this node has no parent, otherwise true
-
addSiblingAfter
Adds the given node as sibling after this node and returns true.
If this node has no parent the sibling cannot be added and false will be returned instead.- Parameters:
sibling-- Returns:
- false if this node has no parent, otherwise true
-
addChild
Adds the given node as child.- Parameters:
child- a new child for this node- Returns:
- this node itself for method chaining
-
addChild
Adds the given node as child at position index.- Parameters:
child- a new child for this node- Returns:
- this node itself for method chaining
- Throws:
IndexOutOfBoundsException- if the index is out of range (index < 0 || index > children.size())
-
getChildren
List containing all children of this node.- Returns:
- list with all children
-
getChildrenWithTag
List containing all children of this node which have the giventag.- Parameters:
tag- the children's tag- Returns:
- list with all children with
tag
-
removeAttribute
Removes an element from the attributes.- Parameters:
key- the key- Returns:
- the previously associated value or null
-
getAttributes
Returns a map which contains all attributes. The keys match the attributes' names.- Returns:
- map with all attributes belonging to this node
-
hasAttribute
Returns whether this node has an attribute with the givenname.- Parameters:
name- the attribute's name- Returns:
- if this node has an attribute with
name
-
getAttribute
Returns the attribute with the givenname.- Parameters:
name- the attribute's name.- Returns:
- attribute with
name.
-
addAttribute
Adds the given attribute to this node. Attributes have unique names. An attribute with the same name will be overwritten.- Parameters:
attr- the attribute to be added.
-
addAttribute
Adds the given attribute to this node. Attributes have unique names. An attribute with the same name will be overwritten.- Parameters:
key- The name of the new attributens- The namespace of the new attributevalue- The value of the new attribute
-
getParent
Returns the parent node.
If this node is part of a valid XML document, consider that only the root node's parent can be and has to be null.- Returns:
- parent node
-
setParent
Sets the parent of this node.- Parameters:
parent- this node's new parent
-
toString
-
removeChild
Remove child 'child' of this node- Parameters:
child-
-
getText
Gets the textual contents of this node- Returns:
- The textual contents of this node
-
setText
Sets the textual contents of this node- Parameters:
text- The textual contents of this node
-