Table of Contents

Class XMPNode

Namespace
iText.Kernel.XMP.Impl
Assembly
itext.kernel.dll

A node in the internally XMP tree, which can be a schema node, a property node, an array node, an array item, a struct node or a qualifier node (without '?').

public class XMPNode : IComparable
Inheritance
XMPNode
Implements
Inherited Members

Remarks

A node in the internally XMP tree, which can be a schema node, a property node, an array node, an array item, a struct node or a qualifier node (without '?'). Possible improvements:

  1. The kind Node of node might be better represented by a class-hierarchy of different nodes.
  2. The array type should be an enum
  3. isImplicitNode should be removed completely and replaced by return values of fi.
  4. hasLanguage, hasType should be automatically maintained by XMPNode

Constructors

XMPNode(string, string, PropertyOptions)

Creates an

XMPNode
with initial values.
public XMPNode(string name, string value, PropertyOptions options)

Parameters

name string

the name of the node

value string

the value of the node

options PropertyOptions

the options of the node

XMPNode(string, PropertyOptions)

Constructor for the node without value.

public XMPNode(string name, PropertyOptions options)

Parameters

name string

the name of the node

options PropertyOptions

the options of the node

Methods

AddChild(int, XMPNode)

Adds a node as child to this node.

public virtual void AddChild(int index, XMPNode node)

Parameters

index int

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 XMPNode

an XMPNode

AddChild(XMPNode)

Adds a node as child to this node.

public virtual void AddChild(XMPNode node)

Parameters

node XMPNode

an XMPNode

AddQualifier(XMPNode)

Appends a qualifier to the qualifier list and sets respective options.

public virtual void AddQualifier(XMPNode qualNode)

Parameters

qualNode XMPNode

a qualifier node.

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.

protected virtual void CleanupChildren()

Clear()

Resets the node.

public virtual void Clear()

Clone()

Performs a deep clone of the node and the complete subtree.

public virtual object Clone()

Returns

object

CloneSubtree(XMPNode)

Performs a deep clone of the complete subtree (children and qualifier )into and add it to the destination node.

public virtual void CloneSubtree(XMPNode destination)

Parameters

destination XMPNode

the node to add the cloned subtree

CompareTo(object)

public virtual int CompareTo(object xmpNode)

Parameters

xmpNode object

Returns

int

DumpNode(bool)

Renders this node and the tree unter this node in a human readable form.

public virtual string DumpNode(bool recursive)

Parameters

recursive bool

Flag is qualifier and child nodes shall be rendered too

Returns

string

Returns a multiline string containing the dump.

FindChildByName(string)

public virtual XMPNode FindChildByName(string expr)

Parameters

expr string

child node name to look for

Returns

XMPNode

Returns an

XMPNode
if node has been found,
null
otherwise.

FindQualifierByName(string)

public virtual XMPNode FindQualifierByName(string expr)

Parameters

expr string

qualifier node name to look for

Returns

XMPNode

Returns a qualifier

XMPNode
if node has been found,
null
otherwise.

GetChild(int)

public virtual XMPNode GetChild(int index)

Parameters

index int

an index [1..size]

Returns

XMPNode

Returns the child with the requested index.

GetChildren()

Note: This method should always be called when accessing 'children' to be sure that its initialized.

protected virtual IList GetChildren()

Returns

IList

Returns list of children that is lazy initialized.

GetChildrenLength()

public virtual int GetChildrenLength()

Returns

int

Returns the number of children without neccessarily creating a list.

GetHasAliases()

public virtual bool GetHasAliases()

Returns

bool

Returns if the node contains aliases (applies only to schema nodes)

GetHasValueChild()

public virtual bool GetHasValueChild()

Returns

bool

the hasValueChild

GetName()

public virtual string GetName()

Returns

string

Returns the name.

GetOptions()

public virtual PropertyOptions GetOptions()

Returns

PropertyOptions

Returns the options.

GetParent()

public virtual XMPNode GetParent()

Returns

XMPNode

Returns the parent node.

GetQualifier(int)

public virtual XMPNode GetQualifier(int index)

Parameters

index int

an index [1..size]

Returns

XMPNode

Returns the qualifier with the requested index.

GetQualifierLength()

public virtual int GetQualifierLength()

Returns

int

Returns the number of qualifier without neccessarily creating a list.

GetUnmodifiableChildren()

public virtual IList GetUnmodifiableChildren()

Returns

IList

Returns a read-only copy of child nodes list.

GetValue()

public virtual string GetValue()

Returns

string

Returns the value.

HasChildren()

public virtual bool HasChildren()

Returns

bool

Returns whether the node has children.

HasQualifier()

public virtual bool HasQualifier()

Returns

bool

Returns whether the node has qualifier attached.

IsAlias()

public virtual bool IsAlias()

Returns

bool

Returns if the node contains aliases (applies only to schema nodes)

IsImplicit()

public virtual bool IsImplicit()

Returns

bool

Returns the implicit flag

IterateChildren()

public virtual IEnumerator IterateChildren()

Returns

IEnumerator

Returns an iterator for the children. Note: take care to use it.remove(), as the flag are not adjusted in that case.

IterateQualifier()

public virtual IEnumerator IterateQualifier()

Returns

IEnumerator

Returns an iterator for the qualifier. Note: take care to use it.remove(), as the flag are not adjusted in that case.

RemoveChild(int)

Removes a child at the requested index.

public virtual void RemoveChild(int itemIndex)

Parameters

itemIndex int

the index to remove [1..size]

RemoveChild(XMPNode)

Removes a child node.

public virtual void RemoveChild(XMPNode node)

Parameters

node XMPNode

the child node to delete.

Remarks

Removes a child node. If its a schema node and doesn't have any children anymore, its deleted.

RemoveChildren()

Removes all children from the node.

public virtual void RemoveChildren()

RemoveQualifier(XMPNode)

Removes one qualifier node and fixes the options.

public virtual void RemoveQualifier(XMPNode qualNode)

Parameters

qualNode XMPNode

qualifier to remove

RemoveQualifiers()

Removes all qualifiers from the node and sets the options appropriate.

public virtual void RemoveQualifiers()

ReplaceChild(int, XMPNode)

Replaces a node with another one.

public virtual void ReplaceChild(int index, XMPNode node)

Parameters

index int

the index of the node that will be replaced. Note: The node children are indexed from [1..size]!

node XMPNode

the replacement XMPNode

SetAlias(bool)

public virtual void SetAlias(bool alias)

Parameters

alias bool

sets the flag that the node is an alias

SetHasAliases(bool)

public virtual void SetHasAliases(bool hasAliases)

Parameters

hasAliases bool

sets the flag that the node contains aliases

SetHasValueChild(bool)

public virtual void SetHasValueChild(bool hasValueChild)

Parameters

hasValueChild bool

the hasValueChild to set

SetImplicit(bool)

public virtual void SetImplicit(bool @implicit)

Parameters

implicit bool

Sets the implicit node flag

SetName(string)

public virtual void SetName(string name)

Parameters

name string

The name to set.

SetOptions(PropertyOptions)

Updates the options of the node.

public virtual void SetOptions(PropertyOptions options)

Parameters

options PropertyOptions

the options to set.

SetParent(XMPNode)

Sets the parent node, this is solely done by

addChild(...)
and
addQualifier()
.
protected virtual void SetParent(XMPNode parent)

Parameters

parent XMPNode

Sets the parent node.

SetValue(string)

public virtual void SetValue(string value)

Parameters

value string

The value to set.

Sort()

Sorts the complete datamodel according to the rules.

public virtual void Sort()

Remarks

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.
  • Sorting will not be used for arrays.
  • Within qualifier "xml:lang" and/or "rdf:type" stay at the top in that order, all others are sorted.