InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IIDXMLDOMNode Class Referenceabstract

#include <IIDXMLDOMNode.h>

Public Types

enum  kNodeTypes {
  kElement, kDocument, kText, kProcessingInstruction,
  kAttribute, kComment, kUnknown
}
 

Public Member Functions

virtual IIDXMLDOMNodeCloneNode (bool deepClone)=0
 
virtual bool16 IsValid () const =0
 
virtual IIDXMLDOMNode::kNodeTypes GetNodeType () const =0
 
virtual bool16 GetLocalName (WideString &localName) const =0
 
virtual bool16 GetNamespaceURI (WideString &namespaceURI) const =0
 
virtual bool16 GetNodeName (WideString &name) const =0
 
virtual bool16 GetNodeValue (WideString &value) const =0
 
virtual void SetNodeValue (const WideString &val)=0
 
virtual bool16 GetPrefix (WideString &prefix) const =0
 
virtual void SetPrefix (const WideString &prefix)=0
 
virtual IIDXMLDOMNamedNodeMapGetAttributes () const =0
 
virtual bool16 HasChildNodes () const =0
 
virtual IIDXMLDOMNListGetChildNodes () const =0
 
virtual IIDXMLDOMNodeGetFirstChild () const =0
 
virtual IIDXMLDOMNodeGetLastChild () const =0
 
virtual IIDXMLDOMNodeGetNextSibling () const =0
 
virtual IIDXMLDOMNodeGetPreviousSibling () const =0
 
virtual IIDXMLDOMNodeGetParentNode () const =0
 
virtual IIDXMLDOMDocumentGetOwnerDocument () const =0
 
virtual void InsertBefore (IIDXMLDOMNode *newNode, IIDXMLDOMNode *whichNode)=0
 
virtual void AppendChild (IIDXMLDOMNode *newChild)=0
 
virtual void ReplaceChild (IIDXMLDOMNode *newChild, IIDXMLDOMNode *oldChild)=0
 
virtual IIDXMLDOMNodeRemoveChild (IIDXMLDOMNode *oldChild)=0
 
virtual BIB_NAMESPACE::CAXENodeDOM GetAXEObject ()=0
 

Detailed Description

DOM Node

Conceptually, a DOM Node is any type of object in a DOM Tree rather than just an element. This includes (elements, attributes, processing instructions, comments, text, etc)

Memory Management

Unless otherwise stated pointers returned by methods in this class are owned by the class and not the client. Exceptions to this rule will be stated clearly where they apply.

Invalid Parameters

Unless otherwise indicated, it is an error to use an invalid container (IsValid() == false), or a NULL pointer, as a parameter to any function. In some instances, the requirement that a specific parameter must be valid is repeated in the commentary for the specific function. The lack of any indication in the commentary for the specific function should still be taken to mean that an invalid container or NULL pointer will result in a kAXEErrClientFault exception.

Member Enumeration Documentation

Supported Node Types
Enumerator
kElement 

Element type

kDocument 

Document type

kText 

Simple Characters

kProcessingInstruction 

Processing Instruction

kAttribute 

Attribute

kComment 

Comment

kUnknown 

Type not supported

Member Function Documentation

virtual void IIDXMLDOMNode::AppendChild (IIDXMLDOMNodenewChild)
pure virtual

Append child node

Adds the node 'newChild' to the end of the list of children of this node.

If the 'newChild' is already in the tree, it is first removed.

Parameters
newChildThe node to add. It must be a node owned by the same document as this node.
See Also
#insertBefore
IIDXMLDOMCDocument::ImportNode
virtual IIDXMLDOMNode* IIDXMLDOMNode::CloneNode (bool deepClone)
pure virtual

Clone a node and optionally clone its descendants

The returned node has no parent (parentNode is null), with the expectation that the client will insert it somewhere in the current document's tree. The source node is not altered or removed from the document; this method creates a new copy of the source node. For all nodes, cloning a node creates a node object owned by the owning document, with DOM IDL attribute values identical to the source node's nodeName and nodeType, plus the DOM IDL attributes related to namespaces (prefix and namespaces URI).

See the W3C DOM specification for the details on how each of the node types is handled during import.

Note: You own the pointer to this node and must either insert it into the document or delete it yourself.

DOM Level 2

Parameters
deepCloneIf 'kTrue', recursively clone the subtree under the specified node; if kFalse, clone only the node itself, as explained above. See the W3C DOM specification for a detailed discussion of the clone and relevance of the 'deepClone' parameter on various node types.
Returns
The cloned node that belongs to the same document as this node.
virtual IIDXMLDOMNamedNodeMap* IIDXMLDOMNode::GetAttributes () const
pure virtual

Get attributes

Get attributes from a kElement node. For any other type of node this function returns nil.

Returns
The map of attributes for this element. If there are no attributes on this element, the length will be 0. If this is not an element node, return will be nil.
virtual BIB_NAMESPACE::CAXENodeDOM IIDXMLDOMNode::GetAXEObject ()
pure virtual

For internal use only.

virtual IIDXMLDOMNList* IIDXMLDOMNode::GetChildNodes () const
pure virtual

List of child nodes

If there are no children, this is a node list containing no nodes. The content of the returned node list is "live" in the sense that, for instance, changes to the children of the node object that it was created from are immediately reflected in the nodes returned by the node list accessors; it is not a static snapshot of the content of the node.

For node types that do not have children, a list of zero length is returned. Note that a zero length node list will not keep the DOM tree alive if all other references to that tree are destroyed.

Returns
Node list of children, which may have a length of 0.
virtual IIDXMLDOMNode* IIDXMLDOMNode::GetFirstChild () const
pure virtual

First child node

Get the first child node. Not all node types have children.

Returns
The first child under this node if there is one. Otherwise nil.
virtual IIDXMLDOMNode* IIDXMLDOMNode::GetLastChild () const
pure virtual

Last child node

Get the last child node. Not all node types have children.

Returns
The last child under this node if there is one. Otherwise nil.
virtual bool16 IIDXMLDOMNode::GetLocalName (WideStringlocalName) const
pure virtual

Local part of qualified name

Get the local part of the qualified name given to this node. Not all node types can have a qualified name. If no qualification was ever specified, this function returns false. The prefix and local part of a qualified name are always stored separately, though the combined qualified name is available through GetNodeName.

Parameters
localNameAn output parameter that is assigned with the local part of the qualified name if it exists, otherwise it is left unchanged.
Returns
'kTrue' if a local part was specified, 'kFalse' otherwise, also 'kFalse' if this node type cannot have a qualified name.
See Also
GetNamespaceURI
GetPrefix
virtual bool16 IIDXMLDOMNode::GetNamespaceURI (WideStringnamespaceURI) const
pure virtual

Namespace URI

WARNING: This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. It is merely the namespace URI given at creation time.

For nodes of any type other than kElement and kAttribute and nodes created with a DOM Level 1 method, such as CreateElement from the IIDXMLDOMDocument interface, this always returns false.

Parameters
namespaceURIAn output parameter that is assigned with the namespace URI if it exists, otherwise it is left unchanged.
Returns
'kTrue' if a namespace URI was defined, 'kFalse' otherwise.
virtual IIDXMLDOMNode* IIDXMLDOMNode::GetNextSibling () const
pure virtual

Next sibling node

Get the sibling that follows this one in document order. Not all node types have siblings.

Returns
The first child after this node if there is one. Otherwise nil.
virtual bool16 IIDXMLDOMNode::GetNodeName (WideStringname) const
pure virtual

Node name

Get the node name. Not all node types have names. Comments will have names and the target of a PI is given by the name property

Parameters
nameAn output parameter that is assigned the node name if this function returns 'true', left unchanged otherwise.
Returns
'true' if this node type has a name, 'false' otherwise.
virtual IIDXMLDOMNode::kNodeTypes IIDXMLDOMNode::GetNodeType () const
pure virtual

Node type

Get the node type. To allow for possible additions in the future, the type is an integer value, selected from the constants enumerated as kNodeTypes.

Returns
Node type code.
See Also
kNodeTypes
virtual bool16 IIDXMLDOMNode::GetNodeValue (WideStringvalue) const
pure virtual

Node value

Get the node value. Not all node types have values. Comments will have their data stored in the value.

Parameters
valAn output parameter that is assigned the node value if this function returns 'true', left unchanged otherwise.
Returns
'true' if this node type has a value, 'false' otherwise.
virtual IIDXMLDOMNode* IIDXMLDOMNode::GetParentNode () const
pure virtual

Parent node

All nodes, except kDocument and kAttribute may have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, nil is returned.

Returns
The parent node if there is one. Otherwise nil.
virtual bool16 IIDXMLDOMNode::GetPrefix (WideStringprefix) const
pure virtual

Prefix of qualified name

Get the prefix of the qualified name given to this node. Not all node types can have a qualified name. If no qualification was ever specified, this function returns false. The prefix and local part of a qualified name are always stored separately, though the combined qualified name is available through GetNodeName.

Parameters
prefixAn output parameter that is assigned with the prefix of the qualified name if it exists, otherwise it is left unchanged.
Returns
'kTrue' if a prefix was specified, 'kFalse' otherwise, also 'kFalse' if this node type cannot have a qualified name.
See Also
GetLocalName
GetNamespaceURI
virtual IIDXMLDOMNode* IIDXMLDOMNode::GetPreviousSibling () const
pure virtual

Previous sibling node

Get the sibling that preceeds this one in document order. Not all node types have siblings.

Returns
The first child before this node if there is one. Otherwise nil.
virtual bool16 IIDXMLDOMNode::HasChildNodes () const
pure virtual

Node has children?

This is a convenience method to allow easy determination of whether a node has any children.

Returns
true if the node has any children, false if the node has no children.
See Also
GetChildNodes
virtual void IIDXMLDOMNode::InsertBefore (IIDXMLDOMNodenewNode,
IIDXMLDOMNodewhichNode 
)
pure virtual

Insert node before

Inserts the node 'newChild' before the existing child node 'refChild', or at the end of the list of children if refChild is nil.

If newChild is already in the tree, it is first removed.

Parameters
newChildThe node to insert. It must be a node owned by the same document as this node.
refChildThe reference node, i.e., the node before which the new node must be inserted. May be invalid. If not invalid, must be a current child of this node.
virtual bool16 IIDXMLDOMNode::IsValid () const
pure virtual

Is Valid Is this node in a valid state

Returns
kTrue - Valid, kFalse - Invalid
virtual void IIDXMLDOMNode::ReplaceChild (IIDXMLDOMNodenewChild,
IIDXMLDOMNodeoldChild 
)
pure virtual

Replace child node

Replaces the child node 'oldChild' with 'newChild' in the list of children.

If the newChild is already in the tree, it is first removed.

Parameters
newChildThe new node to put in the child list. It must be a node owned by the same document as this node.
oldChildThe node being replaced in the list. Must be a current child of this node.
virtual void IIDXMLDOMNode::SetNodeValue (const WideStringval)
pure virtual

Set node value

Any node which can have a nodeValue (

See Also
GetNodeValue) will also accept requests to set it to a string. The exact response to this varies from node to node.

For most types of node, value is null and attempting to set it will result in an error. This will also be the result if the node is read-only.

Parameters
valThe value to set the node to.
virtual void IIDXMLDOMNode::SetPrefix (const WideStringprefix)
pure virtual

Set prefix of qualified name

Note that setting this attribute, when permitted, changes the nodeName attribute, which holds the qualified name, as well as the tagName and name attributes of the an element or attribute interface, when applicable.

Parameters
prefixThe prefix to set.