Class Tag
java.lang.Object
com.itextpdf.tool.xml.Tag
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new tag object.Construct a tag.Create a new tag object. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a child tag to this tag.booleancompareTag(Tag t) Compare this tag with t for namespace and name equality.Finds the first child that matches the given name and namespace.Finds the first child that matches the given name and ns.Returns all children of this tag.getChildren(String name) Returns all children of this tag with the given name.getCSS()Returns a Map of css property, value.getName()Returns the name of the tag.
(Actually the same as getTag method, but after using XMLWorker for a while we caught ourself always trying to call Tag#getName() instead of Tag#getTag())Returns the parent tag for this tag.getTag()Deprecated.marked as deprecated in favor for getName, we won't remove it yet.booleanCheck if this tag has a child with the given name and namespace.booleanCheck if this tag has a child with the given name and namespace.booleanWhether or not this tag has children.booleanWhether or not this tag has a parent.iterator()private TagrecursiveGetChild(Tag tag, String name, String ns, boolean recursive) private booleanrecursiveHasChild(Tag tag, String name, String ns, boolean recursive) voidSet the css map.voidsetLastMarginBottom(Object lastMarginBottom) voidSet the tags parent tag.toString()Print the tagMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
parent
-
tag
-
attributes
-
css
-
children
-
ns
-
lastMarginBottom
-
-
Constructor Details
-
Tag
-
Tag
- Parameters:
tag- the tag name
-
Tag
-
Tag
-
Tag
-
-
Method Details
-
setParent
Set the tags parent tag.- Parameters:
parent- the parent tag of this tag
-
getParent
-
getTag
Deprecated.marked as deprecated in favor for getName, we won't remove it yet.The tags name.- Returns:
- the tag name
-
getCSS
-
setCSS
-
getAttributes
-
addChild
Add a child tag to this tag. The given tags parent is set to this tag.- Parameters:
t- the tag
-
getChildren
-
getChildren
-
getNameSpace
- Returns:
- the ns
-
toString
-
compareTag
Compare this tag with t for namespace and name equality.- Parameters:
t- the tag to compare with- Returns:
- true if the namespace and tag are the same.
-
iterator
-
getChild
-
getChild
Finds the first child that matches the given name and ns. Optionally look in the whole tree (in children of children of children ...)- Parameters:
name- name of the tagns- the namespacerecursive- true if the tree should be fully inwards inspected.- Returns:
- the child if found
-
hasChildren
public boolean hasChildren()Whether or not this tag has children.- Returns:
- true if there are children
-
hasParent
public boolean hasParent()Whether or not this tag has a parent.- Returns:
- true if parent is not
null
-
hasChild
-
hasChild
Check if this tag has a child with the given name and namespace.- Parameters:
name- the name of the tag to look forns- the namespace (if no namespace, set an empty String)recursive- true if children's children children children ... should be inspected too.- Returns:
- true if a child with the given name and ns is found.
-
recursiveHasChild
-
recursiveGetChild
-
getName
Returns the name of the tag.
(Actually the same as getTag method, but after using XMLWorker for a while we caught ourself always trying to call Tag#getName() instead of Tag#getTag())- Returns:
- the name of the tag.
-
getLastMarginBottom
-
setLastMarginBottom
-