iText 5

XmpNodeUtils

XmpNodeUtils Public class

Description

Utilities for ...

Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.xmp.impl iTextSharp.xmp.impl.XmpNodeUtils[[XmpNodeUtils]] end subgraph iTextSharp.xmp iTextSharp.xmp.XmpConst[[XmpConst]] end iTextSharp.xmp.XmpConst --> iTextSharp.xmp.impl.XmpNodeUtils

Members

Methods

Internal Static methods

Returns

Name

void

AppendLangItem

(

XmpNode

arrayNode, string itemLang, string itemValue)
Appends a language item to an alt text array.

object``[]

ChooseLocalizedText

(

XmpNode

arrayNode, string genericLang, string specificLang)

void

DeleteNode

(

XmpNode

node)
Deletes the the given node and its children from its parent.
Takes care about adjusting the flags.

void

DetectAltText

(

XmpNode

arrayNode)
See if an array is an alt-text array. If so, make sure the x-default item
is first.

XmpNode

FindChildNode

(

XmpNode

parent, string childName, bool createNodes)
Find or create a child node under a given parent node. If the parent node is no
Returns the found or created child node.

XmpNode

FindNode

(

XmpNode

xmpTree,

XmpPath

xpath, bool createNodes,

PropertyOptions

leafOptions)
Follow an expanded path expression to find or create a node.

XmpNode

FindSchemaNode

(...)
Find or create a schema node if ...

int

LookupLanguageItem

(

XmpNode

arrayNode, string language)
Looks for the appropriate language item in a text alternative array.item

void

NormalizeLangArray

(

XmpNode

arrayNode)
Make sure the x-default item is first. Touch up "single value"
arrays that have a default plus one real language. This case should have
the same value for both items. Older Adobe apps were hardwired to only
use the "x-default" item, so we copy that value to the other
item.

string

SerializeNodeValue

(object value)
Converts the node value to String, apply special conversions for defined
types in XMP.

void

SetNodeValue

(

XmpNode

node, object value)
This is setting the value of a leaf node.

PropertyOptions

VerifySetOptions

(

PropertyOptions

options, object itemValue)
Verifies the PropertyOptions for consistancy and updates them as needed.
If options are ...

Details

Summary

Utilities for

XMPNode

Inheritance

Methods

FindSchemaNode [1/2]

Source code

internal static XmpNode FindSchemaNode(XmpNode tree, string namespaceUri, bool createNodes)

Arguments

Type

Name

Description

XmpNode

tree

the root of the xmp tree.

string

namespaceUri

a namespace

bool

createNodes

a flag indicating if the node shall be created if not found. Note: The namespace must be registered prior to this call.

Summary

Find or create a schema node if

createNodes

Returns

Returns the schema node if found,

null

otherwise. Note: If

createNodes

is

true

Exceptions

Name

Description

XmpException

An exception is only thrown if an error occurred, not if a
node was not found.

FindSchemaNode [2/2]

Source code

internal static XmpNode FindSchemaNode(XmpNode tree, string namespaceUri, string suggestedPrefix, bool createNodes)

Arguments

Type

Name

Description

XmpNode

tree

the root of the xmp tree.

string

namespaceUri

a namespace

string

suggestedPrefix

If a prefix is suggested, the namespace is allowed to be registered.

bool

createNodes

a flag indicating if the node shall be created if not found. Note: The namespace must be registered prior to this call.

Summary

Find or create a schema node if

createNodes

Returns

Returns the schema node if found,

null

otherwise. Note: If

createNodes

is

true

Exceptions

Name

Description

XmpException

An exception is only thrown if an error occurred, not if a
node was not found.

FindChildNode

Source code

internal static XmpNode FindChildNode(XmpNode parent, string childName, bool createNodes)

Arguments

Type

Name

Description

XmpNode

parent

the parent node

string

childName

the node name to find

bool

createNodes

flag, if new nodes shall be created.

Summary

Find or create a child node under a given parent node. If the parent node is no Returns the found or created child node.

Returns

Returns the found or created node or

null

Exceptions

Name

Description

XmpException

Thrown if

FindNode

Source code

internal static XmpNode FindNode(XmpNode xmpTree, XmpPath xpath, bool createNodes, PropertyOptions leafOptions)

Arguments

Type

Name

Description

XmpNode

xmpTree

the node to begin the search.

XmpPath

xpath

the complete xpath

bool

createNodes

flag if nodes shall be created
(when called by ...

PropertyOptions

leafOptions

the options for the created leaf nodes (only when ...

Summary

Follow an expanded path expression to find or create a node.

Returns

Returns the node if found or created or

null

Exceptions

Name

Description

XmpException

An exception is only thrown if an error occurred,
not if a node was not found.

DeleteNode

Source code

internal static void DeleteNode(XmpNode node)

Arguments

Type

Name

Description

XmpNode

node

the top-most node to delete.

Summary

Deletes the the given node and its children from its parent. Takes care about adjusting the flags.

SetNodeValue

Source code

internal static void SetNodeValue(XmpNode node, object value)

Arguments

Type

Name

Description

XmpNode

node

an XMPNode

object

value

a value

Summary

This is setting the value of a leaf node.

VerifySetOptions

Source code

internal static PropertyOptions VerifySetOptions(PropertyOptions options, object itemValue)

Arguments

Type

Name

Description

PropertyOptions

options

the ...

object

itemValue

the node value to set

Summary

Verifies the PropertyOptions for consistancy and updates them as needed. If options are

null

Returns

Returns the updated options.

Exceptions

Name

Description

XmpException

If the options are not consistant.

SerializeNodeValue

Source code

internal static string SerializeNodeValue(object value)

Arguments

Type

Name

Description

object

value

the node value to set

Summary

Converts the node value to String, apply special conversions for defined types in XMP.

Returns

Returns the String representation of the node value.

NormalizeLangArray

Source code

internal static void NormalizeLangArray(XmpNode arrayNode)

Arguments

Type

Name

Description

XmpNode

arrayNode

an alt text array node

Summary

Make sure the x-default item is first. Touch up "single value" arrays that have a default plus one real language. This case should have the same value for both items. Older Adobe apps were hardwired to only use the "x-default" item, so we copy that value to the other item.

DetectAltText

Source code

internal static void DetectAltText(XmpNode arrayNode)

Arguments

Type

Name

Description

XmpNode

arrayNode

the array node to check if its an alt-text array

Summary

See if an array is an alt-text array. If so, make sure the x-default item is first.

AppendLangItem

Source code

internal static void AppendLangItem(XmpNode arrayNode, string itemLang, string itemValue)

Arguments

Type

Name

Description

XmpNode

arrayNode

the language array

string

itemLang

the language of the item

string

itemValue

the content of the item

Summary

Appends a language item to an alt text array.

Exceptions

Name

Description

XmpException

Thrown if a duplicate property is added

ChooseLocalizedText

Source code

internal static object ChooseLocalizedText(XmpNode arrayNode, string genericLang, string specificLang)

Arguments

Type

Name

Description

XmpNode

arrayNode

string

genericLang

string

specificLang

LookupLanguageItem

Source code

internal static int LookupLanguageItem(XmpNode arrayNode, string language)

Arguments

Type

Name

Description

XmpNode

arrayNode

an array node

string

language

the requested language

Summary

Looks for the appropriate language item in a text alternative array.item

Returns

Returns the index if the language has been found, -1 otherwise.

Exceptions

Name

Description

XmpException

Generated with ModularDoc