public class XMPNode extends Object implements Comparable
| Constructor and Description |
|---|
XMPNode(String name,
PropertyOptions options,
String originalPrefix)
Constructor for the node without value.
|
XMPNode(String name,
String value,
PropertyOptions options,
String originalPrefix)
Creates an
XMPNode with initial values. |
| Modifier and Type | Method and Description |
|---|---|
void |
addChild(int index,
XMPNode node)
Adds a node as child to this node.
|
void |
addChild(XMPNode node)
Adds a node as child to this node.
|
void |
addQualifier(XMPNode qualNode)
Appends a qualifier to the qualifier list and sets respective options.
|
protected void |
cleanupChildren()
Removes the children list if this node has no children anymore;
checks if the provided node is a schema node and doesn't have any children anymore,
its deleted.
|
void |
clear()
Resets the node.
|
Object |
clone()
Performs a deep clone of the node and the complete subtree.
|
void |
cloneSubtree(XMPNode destination)
Performs a deep clone of the complete subtree (children and
qualifier )into and add it to the destination node.
|
int |
compareTo(Object xmpNode) |
String |
dumpNode(boolean recursive)
Renders this node and the tree unter this node in a human readable form.
|
XMPNode |
findChildByName(String expr) |
XMPNode |
findQualifierByName(String expr) |
XMPNode |
getChild(int index) |
int |
getChildrenLength() |
boolean |
getHasAliases() |
boolean |
getHasValueChild() |
String |
getName() |
PropertyOptions |
getOptions() |
String |
getOriginalPrefix() |
XMPNode |
getParent() |
protected List |
getQualifier() |
XMPNode |
getQualifier(int index) |
int |
getQualifierLength() |
List |
getUnmodifiableChildren() |
String |
getValue() |
boolean |
hasChildren() |
boolean |
hasQualifier() |
boolean |
isAlias() |
boolean |
isImplicit() |
boolean |
isLanguageNode() |
Iterator |
iterateChildren() |
Iterator |
iterateQualifier() |
void |
removeChild(int itemIndex)
Removes a child at the requested index.
|
void |
removeChild(XMPNode node)
Removes a child node.
|
void |
removeChildren()
Removes all children from the node.
|
void |
removeQualifier(XMPNode qualNode)
Removes one qualifier node and fixes the options.
|
void |
removeQualifiers()
Removes all qualifiers from the node and sets the options appropriate.
|
void |
replaceChild(int index,
XMPNode node)
Replaces a node with another one.
|
void |
setAlias(boolean alias) |
void |
setHasAliases(boolean hasAliases) |
void |
setHasValueChild(boolean hasValueChild) |
void |
setImplicit(boolean implicit) |
void |
setName(String name) |
void |
setOptions(PropertyOptions options)
Updates the options of the node.
|
protected void |
setParent(XMPNode parent)
Sets the parent node, this is solely done by
addChild(...)
and addQualifier(). |
void |
setValue(String value) |
void |
sort()
Sorts the complete datamodel according to the following rules:
Nodes at one level are sorted by name, that is prefix + local name
Starting at the root node the children and qualifier are sorted recursively,
which the following exceptions.
|
public XMPNode(String name, String value, PropertyOptions options, String originalPrefix)
XMPNode with initial values.name - the name of the nodevalue - the value of the nodeoptions - the options of the nodepublic XMPNode(String name, PropertyOptions options, String originalPrefix)
name - the name of the nodeoptions - the options of the nodepublic String getOriginalPrefix()
public void clear()
public XMPNode getParent()
public XMPNode getChild(int index)
index - an index [1..size]public void addChild(XMPNode node) throws XMPException
node - an XMPNodeXMPExceptionpublic void addChild(int index,
XMPNode node)
throws XMPException
index - the index of the node before which the new one is inserted.
Note: The node children are indexed from [1..size]!
An index of size + 1 appends a node.node - an XMPNodeXMPExceptionpublic void replaceChild(int index,
XMPNode node)
index - the index of the node that will be replaced.
Note: The node children are indexed from [1..size]!node - the replacement XMPNodepublic void removeChild(int itemIndex)
itemIndex - the index to remove [1..size]public void removeChild(XMPNode node)
node - the child node to delete.protected void cleanupChildren()
public void removeChildren()
public int getChildrenLength()
public XMPNode findChildByName(String expr)
expr - child node name to look forXMPNode if node has been found, null otherwise.public XMPNode getQualifier(int index)
index - an index [1..size]public int getQualifierLength()
public void addQualifier(XMPNode qualNode) throws XMPException
qualNode - a qualifier node.XMPExceptionpublic void removeQualifier(XMPNode qualNode)
qualNode - qualifier to removepublic void removeQualifiers()
public XMPNode findQualifierByName(String expr)
expr - qualifier node name to look forXMPNode if node has been found,
null otherwise.public boolean hasChildren()
public Iterator iterateChildren()
public boolean hasQualifier()
public Iterator iterateQualifier()
public Object clone()
clone in class ObjectObject.clone()public void cloneSubtree(XMPNode destination)
destination - the node to add the cloned subtreepublic String dumpNode(boolean recursive)
recursive - Flag is qualifier and child nodes shall be rendered toopublic int compareTo(Object xmpNode)
compareTo in interface ComparableComparable.compareTo(Object)public String getName()
public void setName(String name)
name - The name to set.public String getValue()
public void setValue(String value)
value - The value to set.public PropertyOptions getOptions()
public void setOptions(PropertyOptions options)
options - the options to set.public boolean isImplicit()
public void setImplicit(boolean implicit)
implicit - Sets the implicit node flagpublic boolean getHasAliases()
public void setHasAliases(boolean hasAliases)
hasAliases - sets the flag that the node contains aliasespublic boolean isAlias()
public void setAlias(boolean alias)
alias - sets the flag that the node is an aliaspublic boolean getHasValueChild()
public void setHasValueChild(boolean hasValueChild)
hasValueChild - the hasValueChild to setpublic void sort()
public boolean isLanguageNode()
public List getUnmodifiableChildren()
protected List getQualifier()
protected void setParent(XMPNode parent)
addChild(...)
and addQualifier().parent - Sets the parent node.Copyright © 2015–2021 The veraPDF Consortium. All rights reserved.