public abstract class Node extends Obj
The class provides methods to traverse XML DOMs and XFA DOMs. XFA DOMs differ from XML DOMs in that they are composed exclusively of nodes that belong to an XFA schema.
Modifier and Type | Class and Description |
---|---|
static interface |
Node.ChangeLogger
This interface defines the logging operations available when differences (changes) are encountered
while comparing DOMs using
compareVersions(Node, Node.ChangeLogger, Object) . |
Modifier and Type | Field and Description |
---|---|
static int |
CREATE_ALWAYS_NEW
An allowable enumeration eMode value to the
assignNode() method. |
static int |
CREATE_IF_NOT_EXIST
An allowable enumeration eMode value to the
assignNode() method. |
static int |
CREATE_MUST_NOT_EXIST
An allowable enumeration eMode value to the
assignNode() method. |
static int |
CREATE_REPLACE
An allowable enumeration eMode value to the
assignNode() method. |
static String |
gsXFANamespacePrefix |
ATTR_CHANGED, CHILD_ADDED, CHILD_REMOVED, DESCENDENT_ADDED, DESCENDENT_ATTR_CHANGED, DESCENDENT_REMOVED, DESCENDENT_VALUE_CHANGED, PARENT_CHANGED, PERMS_LOCK_CLEARED, PERMS_LOCK_SET, PROTO_ATTR_CHANGED, PROTO_CHILD_ADDED, PROTO_CHILD_REMOVED, PROTO_DESCENDENT_ADDED, PROTO_DESCENDENT_ATTR_CHANGED, PROTO_DESCENDENT_REMOVED, PROTO_DESCENDENT_VALUE_CHANGED, PROTO_VALUE_CHANGED, UPDATED, VALUE_CHANGED
Modifier and Type | Method and Description |
---|---|
Node |
assignNode(String sSOMExpression,
String sValue,
int eMode)
Assigns the value given to the node located by the given
SOM (Scripting Object Model) expression and interpreted relative
to this node's context.
|
boolean |
checkAncestorPerms()
Determines whether this node and all of its ancestors are unlocked for scripting execution.
|
boolean |
checkDescendentPerms()
Checks that this node and all of its descendents are unlocked for scripting execution.
|
boolean |
checkPerms()
Determines whether this node is unlocked for scripting execution.
|
void |
cleanDirtyFlags() |
abstract Node |
clone(Element parent) |
boolean |
compareVersions(Node oRollbackNode,
Node.ChangeLogger oChangeLogger,
Object oUserData)
Determines if this node (and all it's descendants) differs from the given roll-back node.
|
NodeList |
getAll(boolean bByName)
Return the collection of like-named, in-scope, nodes.
|
String |
getData()
Gets this node's data.
|
Node |
getFirstXFAChild()
Gets this node's first XFA child.
|
Node |
getFirstXMLChild()
Gets this node's first XML child.
|
Element |
getFirstXMLChildElement()
Return the first child that is an element.
|
int |
getIndex(boolean bByName) |
Node |
getLastXMLChild()
Gets this node's last XML child.
|
boolean |
getLocked()
Gets the locked state of this node.
|
Model |
getModel()
Gets this node's model.
|
abstract String |
getName()
Gets this node's name.
|
Node |
getNextXFASibling()
Gets this node's next XFA sibling.
|
Node |
getNextXMLSibling()
Gets this node's next XML sibling.
|
Element |
getNextXMLSiblingElement()
Return the next sibling that is an element.
|
static String |
getNodeAsXML(Node oNode)
Helper routine for compareVersions()
|
NodeList |
getNodes()
Gets this node's list of all child nodes.
|
Document |
getOwnerDocument()
Gets this node's owner document.
|
static String |
getPIAsXML(String sPI)
Helper routine for compareVersions()
|
String |
getPIName(Element oNode,
String sPI)
Helper routine for compareVersions()
|
Node |
getPreviousXMLSibling()
Gets this node's previous XML sibling.
|
String |
getPrivateName()
used for determining uniqueness when resolving protos
|
Object |
getProperty(int ePropertyTag,
int nOccurrence)
Get a property for this node.
|
Object |
getProperty(String propertyName,
int nOccurrence)
string version of getProperty.
|
static String |
getPropName(Element oNode,
int eTag)
Helper routine for compareVersions()
|
ScriptTable |
getScriptTable() |
Node |
getSibling(int index,
boolean bByName,
boolean bExceptionIfNotFound) |
String |
getSOMExpression()
Gets this element's absolute SOM expression.
|
String |
getSOMExpression(Node oRelativeTo,
boolean bSkipZeroIndex)
Gets this element's relative SOM expression.
|
String |
getSomName() |
String |
getUniqueSOMName(Element contextNode) |
boolean |
getWillDirty() |
int |
getXFAChildCount()
Gets this node's number of XFA children.
|
Element |
getXFAParent()
Gets this node's XFA parent.
|
Element |
getXfaPeer()
Gets the XFA DOM Node that is the peer to this XML DOM Node.
|
int |
getXMLChildCount()
Gets this node's XML child count.
|
Element |
getXMLParent()
Gets this node's XML parent.
|
void |
hasChanged(boolean bIsDirty)
Sets this changed state of this node and its descendants to the given state.
|
boolean |
isContainer()
Check to see if this is a container object.
|
boolean |
isDefault(boolean bCheckProto) |
boolean |
isDirty()
Determine if this node is dirty.
|
abstract boolean |
isLeaf()
Is this node is a leaf.
|
boolean |
isMapped()
Get the mapped state for the current node.
|
boolean |
isPermsLockSet()
Gets the permissions state of this node.
|
boolean |
isPropertySpecified(int ePropertyTag,
boolean bCheckProtos,
int nOccurrence)
Check if a specific property has been defined for this node.
|
boolean |
isSpecified(int ePropertyTag,
boolean bCheckProtos,
int nOccurrence)
Check if a property, child, or oneOfChild has been defined for this node
|
boolean |
isTransient()
Determine if this node is transient or not.
|
void |
isTransient(boolean bTransient,
boolean bSetChildren)
Set the transient state of this node.
|
boolean |
isTransparent() |
Node |
locateChildByClass(int eChildTag,
int nIndex) |
Node |
locateChildByName(String aChildName,
int nIndex)
Note.
|
void |
logValueChangeHelper(Node oContainer,
String sNewValue,
Node.ChangeLogger oChangeLogger,
Object oUserData)
Helper routine for compareVersions()
|
void |
makeDefault()
Mark this element as a default property
|
void |
makeNonDefault(boolean bRecursive)
Mark this element to indicate it is not a default property
|
void |
notifyPeers(int eventType,
String arg1,
Object arg2)
Sends notification to the peer nodes that this object has changed.
|
Node |
peekOneOfChild(boolean bReturnDefault)
READ ONLY VERSION of getOneOfChild In the case where an element may
contain a "OneOf" child, this method will retrieve the child element that
has the XFA::oneOfChild relationship to its parent.
|
boolean |
performSOMAssignment(String sLHS,
String sRHS,
Obj[] oObjectParameters) |
abstract void |
postSave() |
abstract void |
preSave(boolean bSaveXMLScript) |
void |
remove()
Removes this node from its parent child list.
|
Node |
resolveNode(String somExpr)
Evaluates the Scripting Object Model expression, using this node as
the current context.
|
Node |
resolveNode(String somExpr,
boolean bPeek,
boolean bLastOccurence,
boolean bNoProperties)
Evaluates the Scripting Object Model expression, using this node as
the current context.
|
Node |
resolveNode(String somExpr,
boolean bPeek,
boolean bLastOccurence,
boolean bNoProperties,
DependencyTracker dependencyTracker,
BooleanHolder isAssociation)
Evaluates the Scripting Object Model expression, using this node as
the current context.
|
NodeList |
resolveNodes(String somExpr,
boolean bPeek,
boolean bLastOccurence,
boolean bNoProperties)
Evaluates the Scripting Object Model expression, using this node as
the current context.
|
NodeList |
resolveNodes(String somExpr,
boolean bPeek,
boolean bLastOccurence,
boolean bNoProperties,
DependencyTracker dependencyTracker,
BooleanHolder isAssociation)
Evaluates the Scripting Object Model expression, using this node as
the current context.
|
void |
sendMessenge(ExFull error,
int eSeverity)
Send message to host so it can be logged
|
abstract void |
serialize(OutputStream outFile,
DOMSaveOptions options,
int level,
Node prevSibling)
The helper function used by saveXML()
|
void |
setDirty()
Set the dirty state of this node.
|
void |
setDocument(Document document) |
void |
setLocked(boolean bLockState)
Set the locked state of this node to be locked
|
void |
setMapped(boolean bIsMapped)
Set the mapped state for the current node.
|
void |
setName(String aName) |
void |
setPermsLock(boolean bPermsLock)
Sets the permissions state of this node.
|
void |
setPrivateName(String aNewName)
used when resolving protos
|
void |
setWillDirty(boolean bWillDirty) |
void |
setXfaPeer(Element xfaPeer) |
void |
unLock() |
boolean |
validateSchema(int nTargetVersion,
int nTargetAvailability,
boolean bRecursive,
List<NodeValidationInfo> pValidationInfo)
Validate this node against the schema.
|
boolean |
validateUsage(int nXFAVersion,
int nAvailability,
boolean bUpdateVersion)
Validate if the given Version and Availability flags are valid for the
current document
|
boolean |
validateUsageFailedIsFatal(int nXFAVersion,
int nAvailability)
Determines if disallowing a version should be considered a fatal error.
|
addPeer, addPeeredNode, clearPeers, deafen, getClassAtom, getClassName, getClassTag, getPeer, getScriptMethodInfo, getScriptProperty, getScriptThis, invokeFunction, isDeaf, isMute, isSameClass, isSameClass, isSameClass, mute, peerRemoved, removePeer, removePeeredNode, setClass, setClassTag, setScriptProperty, unDeafen, unMute, updateFromPeer
public static final int CREATE_REPLACE
assignNode()
method.public static final int CREATE_MUST_NOT_EXIST
assignNode()
method.public static final int CREATE_IF_NOT_EXIST
assignNode()
method.public static final int CREATE_ALWAYS_NEW
assignNode()
method.public static final String gsXFANamespacePrefix
public Node assignNode(String sSOMExpression, String sValue, int eMode)
If the node doesn't exist, it can be created depending of the value of the given eMode. The eMode values are:
sSOMExpression
- a SOM expression evaluating to a node.sValue
- the value to be assigned.eMode
- specifies whether the node should be created or not.public boolean checkPerms()
true
if this node is unlocked for scripting execution.setPermsLock(boolean)
,
checkAncestorPerms()
,
checkDescendentPerms()
public boolean checkAncestorPerms()
true
if this node and all of its ancestors are unlocked for scripting execution.setPermsLock(boolean)
,
checkPerms()
,
checkDescendentPerms()
public boolean checkDescendentPerms()
true
if this node and all of its descendents are unlocked for scripting execution.setPermsLock(boolean)
,
checkPerms()
,
checkAncestorPerms()
public NodeList getAll(boolean bByName)
public final int getXMLChildCount()
public String getData()
public Node getFirstXMLChild()
public final Element getFirstXMLChildElement()
public Node getFirstXFAChild()
public int getIndex(boolean bByName)
public Node getLastXMLChild()
public final boolean getLocked()
public Model getModel()
public abstract String getName()
public final Node getNextXMLSibling()
public final Element getNextXMLSiblingElement()
public Node getNextXFASibling()
public NodeList getNodes()
public final Document getOwnerDocument()
public Element getXMLParent()
getXFAParent()
public Element getXFAParent()
getXMLParent()
public Node getPreviousXMLSibling()
public String getPrivateName()
public Object getProperty(int ePropertyTag, int nOccurrence)
ePropertyTag
- The XFA tag (name) of the property to check for.nOccurrence
- if this property can occur a fix number of times (usually
[0..n]), then specify which occurrence to get. Defaults to 0.XFA::textNodeTag()
.
The return value will never be a null object. The XFAProperty will refer
to either an Node or an Attribute.public Object getProperty(String propertyName, int nOccurrence)
public ScriptTable getScriptTable()
getScriptTable
in class Obj
public Node getSibling(int index, boolean bByName, boolean bExceptionIfNotFound)
public final String getSOMExpression()
public final String getSOMExpression(Node oRelativeTo, boolean bSkipZeroIndex)
oRelativeTo
- if non-null, the SOM expression will be
relative to this node. In order for this to be useful, the
given node must be in the parent hierarchy of this element.public String getSomName()
public boolean getWillDirty()
public final int getXFAChildCount()
public final void hasChanged(boolean bIsDirty)
bIsDirty
- the dirty state.public final void cleanDirtyFlags()
public boolean isContainer()
public boolean isDefault(boolean bCheckProto)
public final boolean isDirty()
public final void setDirty()
public final void setDocument(Document document)
public abstract boolean isLeaf()
public boolean isMapped()
public boolean isPermsLockSet()
true
if the node is locked.public boolean isPropertySpecified(int ePropertyTag, boolean bCheckProtos, int nOccurrence)
ePropertyTag
- The XFA tag (name) of the property to check for.bCheckProtos
- if true, check if this property is specified via prototype
inheritance. Defaults to true.nOccurrence
- if this property can occur a fix number of times (usually
[0..n]), then specify which occurrence to check for. Defaults
to 0.The property name should correspond to the name of either a child element that occurs 0..1 times OR is the name of an attribute. The parameter propertyName must be a valid property for this particular class.
public boolean isSpecified(int ePropertyTag, boolean bCheckProtos, int nOccurrence)
ePropertyTag
- The XFA tag (name) of the property/child/oneOfChild to check
for.bCheckProtos
- if true, check if this property is specified via prototype
inheritance. Defaults to true.nOccurrence
- if this property can occur a fix number of times (usually
[0..n]), then specify which occurrence to check for. Defaults
to 0.public boolean isTransient()
public void isTransient(boolean bTransient, boolean bSetChildren)
bTransient
- the new transient state.public boolean isTransparent()
public Node locateChildByClass(int eChildTag, int nIndex)
public final Node locateChildByName(String aChildName, int nIndex)
public void makeDefault()
public void makeNonDefault(boolean bRecursive)
public void notifyPeers(int eventType, String arg1, Object arg2)
Peer
notifyPeers
in interface Peer
notifyPeers
in class Obj
eventType
- the event type as enumerated in this classarg1
- additional event informationarg2
- additional event informationpublic boolean performSOMAssignment(String sLHS, String sRHS, Obj[] oObjectParameters)
public Node peekOneOfChild(boolean bReturnDefault)
When one only one child node out of a set of nodes can exist for a particular node, then that set of nodes is called a oneOf children.
Note! Proto references are not expanded, SHOULD NOT modify the resulting node.
bReturnDefault
- true if you want the defualt node to be returned if the
"OneOf" child doesn't exist, if false null will be returnedpublic abstract void postSave()
public abstract void preSave(boolean bSaveXMLScript)
public void remove()
public final Node resolveNode(String somExpr)
For example, resolveNode("data.name[1]")
returns the requested node if it exists; otherwise it returns null.
The method call resolveNode(somExpr)
is equivalent
to the call:
resolveNode(somExpr, false, false, false)
somExpr
- a SOM expression.ExFull
- of type SOMTypeException, if more than one node
was found.resolveNode(String, boolean, boolean, boolean)
public final Node resolveNode(String somExpr, boolean bPeek, boolean bLastOccurence, boolean bNoProperties)
To peek at the node, set the peek argument to true. If the node is present, it is returned; otherwise null is returned. When set to true, default properties aren't created, and proto references are not expanded.
somExpr
- a SOM expression.bPeek
- whether to beek at the node, or not.bLastOccurence
- whether to get the last occurence
of the node whenever [*] is used in the somExpr argument, or not.bNoProperties
- whether to return no properties
in the result, or not.ExFull
- of type SOMTypeException, if more than one node
was found.public final Node resolveNode(String somExpr, boolean bPeek, boolean bLastOccurence, boolean bNoProperties, DependencyTracker dependencyTracker, BooleanHolder isAssociation)
public NodeList resolveNodes(String somExpr, boolean bPeek, boolean bLastOccurence, boolean bNoProperties)
For example, resolveNodes("data.name[*]")
returns a node list corresponding to the SOM expression, which may be
an empty.
somExpr
- a SOM expression.bPeek
- if true, don't create default properties in the result.bLastOccurence
- if true, only get the last occurence whenever [*]
is used in the SOM expression.bNoProperties
- if true, don't return properties in the result.public NodeList resolveNodes(String somExpr, boolean bPeek, boolean bLastOccurence, boolean bNoProperties, DependencyTracker dependencyTracker, BooleanHolder isAssociation)
public void sendMessenge(ExFull error, int eSeverity)
Obj
sendMessenge
in class Obj
error
- contains message Id and texteSeverity
- the message severityObj.sendMessenge(ExFull, int)
public abstract void serialize(OutputStream outFile, DOMSaveOptions options, int level, Node prevSibling) throws IOException
outFile
- Streamfile to write tooptions
- save optionslevel
- the indent levelprevSibling
- our previous sibling -- needed for some markup options.IOException
public final void setLocked(boolean bLockState)
public void setMapped(boolean bIsMapped)
bIsMapped
- public void setName(String aName)
public void setPermsLock(boolean bPermsLock)
bPermsLock
- the permissions state to set this node to: true
will lock the node; false
will unlock the node.public void setWillDirty(boolean bWillDirty)
public void setPrivateName(String aNewName)
public final void unLock()
public boolean validateSchema(int nTargetVersion, int nTargetAvailability, boolean bRecursive, List<NodeValidationInfo> pValidationInfo)
nTargetVersion
- the target XFA versionnTargetAvailability
- a collection of bits defining what subsets of the schema are supportedpValidationInfo
- list of invalid children, attributes and attribute values based on the target
version and availability. If this node is not valid child of its parent this node will be
the first entry of pInfo.public boolean validateUsage(int nXFAVersion, int nAvailability, boolean bUpdateVersion)
Obj
validateUsage
in class Obj
nXFAVersion
- The target XFA VersionnAvailability
- The target Availability flags, this indicates for what clients
the script is availablebUpdateVersion
- indicates if the model version can be updated by the calling
codeObj.validateUsage(int, int, boolean)
public boolean validateUsageFailedIsFatal(int nXFAVersion, int nAvailability)
Obj
This method is called after calling
Obj.validateUsage(int, int, boolean)
when that method returns false.
validateUsageFailedIsFatal
in class Obj
nXFAVersion
- The target XFA VersionnAvailability
- The target Availability flags, this indicates for what clients
the script is availableObj.validateUsageFailedIsFatal(int, int)
public boolean compareVersions(Node oRollbackNode, Node.ChangeLogger oChangeLogger, Object oUserData)
oRollbackNode
- the roll-back node.oChangeLogger
- an optional (may be null) instance of a change logger.
The change logger's methods will be called for each change found.oUserData
- an optional (may be null) user-supplied object managed by the change logger.public static String getPropName(Element oNode, int eTag)
public void logValueChangeHelper(Node oContainer, String sNewValue, Node.ChangeLogger oChangeLogger, Object oUserData)
public Element getXfaPeer()
public void setXfaPeer(Element xfaPeer)
xfaPeer
- Copyright © 2010 - 2020 Adobe. All Rights Reserved