class Entity
Direct Known Subclasses:
Wrapper of the native browser XML node class. This class provides methods for querying, traversing, and creating
XML entities.
This class is never instantiated by the developer, rather instances are returned from various methods in this
class and the
jsx3.xml.Document class.
Note that several methods of this class fail quietly when an error occurs with the wrapped native browser XML
classes. Methods that are documented as failing quietly should always be followed by a call to
hasError() to ensure that no error has occurred.
| Field Summary |
|---|
| static int | The node type for an attribute node. |
| static int | The node type for a character data node. |
| static int | The node type for a comment node. |
| static int | The node type for an element node. |
| static int | The node type for a text node. |
| Constructor Summary |
|---|
| void | The instance initializer. |
| Method Summary |
|---|
| jsx3.xml.Entity | Appends the objEntity parameter as a child of this entity. |
| jsx3.xml.Entity | Creates a new node that is an exact clone of this node. |
| jsx3.xml.Entity | Creates a new node and returns as jsx3.xml.Entity instance |
| boolean | Tests the equivalency of two jsx3.xml.Entity instances as they wrap and can therefore point to the same native entity, causing a standard "==" comparison to fail |
| String | Returns the value for the named attribute strName. |
| Array<String> | Returns the names of all the attributes of this node. |
| jsx3.xml.Entity | Returns an object reference (a jsx3.xml.Entity instance) to the child attribute with the name, @strName. |
| jsx3.util.List<jsx3.xml.Entity> | Returns handle to a jsx3.util.List instance of all children; note that this collection will always be empty (length = 0) for all types except for jsx3.xml.Entity.TYPEELEMENT |
| String | Returns the right-hand side of a namespace qualified name. |
| jsx3.util.Iterator<jsx3.xml.Entity> | Returns an iterator that iterates over the child nodes of this node. |
| jsx3.util.List<jsx3.xml.Entity> | Returns the child nodes of this entity. |
| Object | Returns an error object (a plain JavaScript object) with two properties that the developer can query for:
code – an integer error code, 0 for no error. |
| jsx3.xml.Entity | Returns the first child element of type jsx3.xml.Entity.TYPEELEMENT; requires that this object also be of TYPEELEMENT; returns null if both conditions are not met |
| jsx3.xml.Entity | Returns the last child element of type jsx3.xml.Entity.TYPEELEMENT; requires that this object also be of TYPEELEMENT; returns null if both conditions are not met |
| String | Returns the value (as string) for URI (universal resource identifier) of the namespace for the given node; returns an empty string if no namespace exists |
| Object | Returns the native browser XML node wrapped by this entity. |
| jsx3.xml.Entity | Returns the next sibling if this node and the referenced sibling are of type jsx3.xml.Entity.TYPEELEMENT; returns null if condition is not met |
| String | Returns the name of the node as string (assuming this jsx3.xml.Entity instance is of type jsx3.xml.Entity.TYPEELEMENT or jsx3.xml.Entity.TYPEATTRIBUTE). |
| int | Returns one of: jsx3.xml.Entity.TYPEELEMENT, jsx3.xml.Entity.TYPEATTRIBUTE, jsx3.xml.Entity.TYPETEXT, jsx3.xml.Entity.TYPECDATA |
| jsx3.xml.Document | Returns the document that owns this entity. |
| jsx3.xml.Entity | Returns the parent node as a jsx3.xml.Entity instance; if this node is the root node of the document, null is returned |
| String | Returns the left-hand side of a namespace qualified name. |
| jsx3.xml.Entity | Returns the previous sibling if this node and the referenced sibling are of type jsx3.xml.Entity.TYPEELEMENT; returns null if condition is not met |
| jsx3.xml.Entity | Returns reference to the document element (root) wrapped in jsx3.xml.Entity instance |
| String | Contains the text content of the node, including the concatenated text contained by all descendant entities |
| static String | |
| String | Deprecated. Use toString() instead. |
| boolean | Returns true if the last operation on this XML entity caused an error. |
| jsx3.xml.Entity | inserts the jsx3.xml.Entity instance, @objEntityNew immediately before the existing child @objEntityRef and returns a handle to @objEntityNew; requires that both parameters be of type jsx3.xml.Entity.TYPEELEMENT; requires that this object also be of TYPEELEMENT; returns null if all conditions are not met |
| void | Removes the specified attribute by the given name (can only be called for nodes of type jsx3.xml.Entity.TYPELEMENT) |
| jsx3.xml.Entity | removes the attribute object as a child of the element; |
| jsx3.xml.Entity | Removes the specified child (@objChildEntity) from the list of children and returns it; returns null if @objChildEntity is not actually a child |
| void | Removes all descendant entities of this node
|
| jsx3.xml.Entity | replaces the child @objEntityOld with @objEntityNew and returns a handle to @objEntityOld; requires that both child entities be of type jsx3.xml.Entity.TYPEELEMENT; requires that this object also be of TYPEELEMENT; returns null if all conditions are not met |
| jsx3.util.Iterator<jsx3.xml.Entity> | Returns an iterator that iterates over the the result of an XPath query. |
| jsx3.util.List<jsx3.xml.Entity> | Returns a list of nodes selected by an XPath query executed on this node. |
| jsx3.xml.Entity | Returns a single node selected by an XPath query executed on this node, or null if none is selected. |
| jsx3.xml.Entity | Sets the @strValue of the named @strAttribute and binds as child of this |
| jsx3.xml.Entity | Sets the attribute object as a child of the element; if transferring an attribute from one element to another, this call must be preceded with removeAttributeNode on the previous owner |
| jsx3.xml.Entity | sets the text value for this entity; returns a handle to this jsx3.xml.Entity instance |
| String | Returns the XML (as String) for this node and any descendants. |
| String | jsx3.xml.Document | performs an XSLT transformation, using @objEntityFilter as the XSLT filter for the transformation; returns
results of the transformation as a string (of text/html/xml/etc) |
| Methods Inherited From jsx3.lang.Object |
|---|
| clone, eval, getClass, getInstanceOf, getInstanceOfClass, getInstanceOfPackage, instanceOf, isInstanceOf, isSubclassOf, jsxmix, jsxsuper, jsxsupermix, setInstanceOf |
static final
int TYPEATTRIBUTE
The node type for an attribute node.
static final
int TYPECDATA
The node type for a character data node.
static final
int TYPECOMMENT
The node type for a comment node.
static final
int TYPEELEMENT
The node type for an element node.
static final
int TYPETEXT
The node type for a text node.
The instance initializer. If an error occurs while instantiating this entity, this method sets the error
property of this entity and returns quietly.
Parameters:
objEntity – the browser native entity instance to wrap.
Appends the objEntity parameter as a child of this entity. If an error occurs while
appending to this XML entity, this method sets the error property of this entity and returns quietly.
Parameters:
objEntity – jsx3.xml.Entity instance that will be bound as a child to this jsx3.xml.Entity instance
Returns:
reference to self
Creates a new node that is an exact clone of this node. If an error occurs while
cloning this XML entity, this method sets the error property of this entity and returns quietly.
Parameters:
bDeep – if true, all descendants of this object will also be cloned and returned
Returns:
newly cloned MSXML Node object wrapped in a jsx3.xml.Entity instance
Creates a new node and returns as jsx3.xml.Entity instance
Parameters:
intType – Four types are supported: jsx3.xml.Entity.TYPEELEMENT, jsx3.xml.Entity.TYPEATTRIBUTE, jsx3.xml.Entity.TYPETEXT, jsx3.xml.Entity.TYPECDATA. Note: only nodes of TYPEELEMENT and TYPEATTRIBUTE will pay attention to the @strNodeName property; if not of this TYPE, pass an empty string
strNodeName – node name for the node to add as a child
strNS – namespace URI for the node being created, if it is preceded by a URI.
So, for example, if 'strName' is "xsi:string", then the 'strNS'
value should be the namespace associated with the xsi prefix
Returns:
reference to the new node wrapped in a jsx3.xml.Entity instance
Tests the equivalency of two jsx3.xml.Entity instances as they wrap and can therefore point to the same native entity, causing a standard "==" comparison to fail
Parameters:
objEntity – jsx3.xml.Entity object
Returns:
true or false
Overrides:
Returns the value for the named attribute strName.
Parameters:
strName – the name of the attribute.
Returns:
the attribute value or undefined if the attribute does not exist.
Returns the names of all the attributes of this node. Iterating over the attribute names is more performant than
using the getAttributes() method.
Returns:
Since:
3.4
See Also:
Returns an object reference (a jsx3.xml.Entity instance) to the child attribute with the name, @strName.
This method should only be called on an instance of type TYPEELEMENT.
Parameters:
strName – name of the attribute
Returns:
jsx3.xml.Entity instance referencing a single attribute node object
Returns handle to a jsx3.util.List instance of all children; note that this collection will always be empty (length = 0) for all types except for jsx3.xml.Entity.TYPEELEMENT
Returns:
See Also:
Returns the right-hand side of a namespace qualified name. For example, "Price" will be returned for the
element <USD:Price>
Returns:
Returns an iterator that iterates over the child nodes of this node. Note that the iterator grants access to
only one child node at a time; once next() is called, the value returned by the previous call to
next() is no longer valid. This method is more performant than getChildNodes().
Parameters:
bIncludeText – if true then the returned iterator will include the child text nodes
of this node.
Returns:
Since:
3.4
See Also:
Returns the child nodes of this entity. By default this method only returns the child nodes that are elements.
Text and CDATA children will be returned if bIncludeText is true.
Parameters:
bIncludeText – if true, text and cdata children are returned with element children.
Returns:
See Also:
Returns an error object (a plain JavaScript object) with two properties that the developer can query for:
- code – an integer error code, 0 for no error.
- description – a text description of the error that occurred.
Returns:
Returns the first child element of type jsx3.xml.Entity.TYPEELEMENT; requires that this object also be of TYPEELEMENT; returns null if both conditions are not met
Returns:
jsx3.xml.Entity instance or null
Returns the last child element of type jsx3.xml.Entity.TYPEELEMENT; requires that this object also be of TYPEELEMENT; returns null if both conditions are not met
Returns:
jsx3.xml.Entity instance or null
Returns the value (as string) for URI (universal resource identifier) of the namespace for the given node; returns an empty string if no namespace exists
Returns:
Returns the native browser XML node wrapped by this entity.
Returns:
Returns the next sibling if this node and the referenced sibling are of type jsx3.xml.Entity.TYPEELEMENT; returns null if condition is not met
Returns:
jsx3.xml.Entity instance or null
Returns the name of the node as string (assuming this jsx3.xml.Entity instance is of type jsx3.xml.Entity.TYPEELEMENT or jsx3.xml.Entity.TYPEATTRIBUTE). The other TYPES return "#cdata-section" and "#text" respectively
Returns:
Returns one of: jsx3.xml.Entity.TYPEELEMENT, jsx3.xml.Entity.TYPEATTRIBUTE, jsx3.xml.Entity.TYPETEXT, jsx3.xml.Entity.TYPECDATA
Returns:
Returns the document that owns this entity.
Returns:
Returns the parent node as a jsx3.xml.Entity instance; if this node is the root node of the document, null is returned
Returns:
parent node or null
Returns the left-hand side of a namespace qualified name. For example, "USD" will be returned for the
element <USD:Price>
Returns:
Returns the previous sibling if this node and the referenced sibling are of type jsx3.xml.Entity.TYPEELEMENT; returns null if condition is not met
Returns:
jsx3.xml.Entity instance or null
Returns reference to the document element (root) wrapped in jsx3.xml.Entity instance
Returns:
jsx3.xml.Entity instance
Contains the text content of the node, including the concatenated text contained by all descendant entities
Returns:
Deprecated.
Returns the release/build for the class (i.e., "2.2.00")
Returns:
Deprecated. Use toString() instead.
Returns the XML (as String) for this node and any descendants. For an attribute this would be the
attribute name and value (i.e., name="value")
Returns:
See Also:
Returns true if the last operation on this XML entity caused an error.
Returns:
inserts the jsx3.xml.Entity instance, @objEntityNew immediately before the existing child @objEntityRef and returns a handle to @objEntityNew; requires that both parameters be of type jsx3.xml.Entity.TYPEELEMENT; requires that this object also be of TYPEELEMENT; returns null if all conditions are not met
Parameters:
objEntityNew – jsx3.xml.Entity object (the new one to add)
objEntityRef – jsx3.xml.Entity object (the reference node in front of which to insert the new node)
Returns:
jsx3.xml.Entity instance or null
void removeAttribute(strAttName
: String)
Removes the specified attribute by the given name (can only be called for nodes of type jsx3.xml.Entity.TYPELEMENT)
Parameters:
strAttName – the name of the attribute to remove
removes the attribute object as a child of the element;
Parameters:
objAtt – jsx3.xml.Entity instance of type jsx3.xml.Entity.TYPEATTRIBUTE;
Returns:
reference to this
Removes the specified child (@objChildEntity) from the list of children and returns it; returns null if @objChildEntity is not actually a child
Parameters:
objChildEntity – jsx3.xml.Entity object that is a direct child of this jsx3.xml.Entity instance
Returns:
jsx3.xml.Entity instance or null
void removeChildren()
Removes all descendant entities of this node
replaces the child @objEntityOld with @objEntityNew and returns a handle to @objEntityOld; requires that both child entities be of type jsx3.xml.Entity.TYPEELEMENT; requires that this object also be of TYPEELEMENT; returns null if all conditions are not met
Parameters:
objEntityNew – jsx3.xml.Entity object (the new one to add)
objEntityOld – jsx3.xml.Entity object (the old one to remove)
Returns:
jsx3.xml.Entity instance or null
Returns an iterator that iterates over the the result of an XPath query. Note that the iterator grants access to
only one child node at a time; once next() is called, the value returned by the previous call to
next() is no longer valid. This method is more performant than selectNodes().
Parameters:
strQuery – an XPath query such as: //somenode[@id='12']/somechild.
strNS – the selection namespace to use just for this query. This parameter is an optional
shortcut for calling setSelectionNamespaces() on the owning document. The format of this parameter
as a string is "xmlns:ns1='uri1' xmlns:ns2='uri2'" or as an object is {'uri1':'ns1',
'uri2':'ns2'}.
Returns:
Since:
3.4
See Also:
Returns a list of nodes selected by an XPath query executed on this node.
Parameters:
strQuery – an XPath query such as: //somenode[@id='12']/somechild.
strNS – the selection namespace to use just for this query. This parameter is an optional
shortcut for calling setSelectionNamespaces() on the owning document. The format of this parameter
as a string is "xmlns:ns1='uri1' xmlns:ns2='uri2'" or as an object is {'uri1':'ns1',
'uri2':'ns2'}.
Returns:
See Also:
Returns a single node selected by an XPath query executed on this node, or null if none is selected.
Parameters:
strQuery – an XPath query such as: //somenode[@id='12']/somechild.
strNS – the selection namespace to use just for this query. This parameter is an optional
shortcut for calling setSelectionNamespaces() on the owning document. The format of this parameter
as a string is "xmlns:ns1='uri1' xmlns:ns2='uri2'" or as an object is {'uri1':'ns1',
'uri2':'ns2'}.
Returns:
jsx3.xml.Entity instance or null
Sets the @strValue of the named @strAttribute and binds as child of this
Parameters:
strName – name of the attribute
strValue – value of the attribute, if null then remove the attribute
Returns:
reference to this
Sets the attribute object as a child of the element; if transferring an attribute from one element to another, this call must be preceded with removeAttributeNode on the previous owner
Parameters:
objAtt – jsx3.xml.Entity instance of type jsx3.xml.Entity.TYPEATTRIBUTE;
Returns:
reference to this
sets the text value for this entity; returns a handle to this jsx3.xml.Entity instance
Parameters:
strValue – value to set for this entity
Returns:
self
Returns the XML (as String) for this node and any descendants. For an attribute this would be the
attribute name and value (i.e., name="value")
Returns:
Overrides:
performs an XSLT transformation, using @objEntityFilter as the XSLT filter for the transformation; returns
results of the transformation as a string (of text/html/xml/etc)
Parameters:
objEntityFilter – jsx3.xml.Entity instance containing the XSLT document to transform 'this' jsx3.xml.Entity instance with
objParams – JavaScript object array of name/value pairs; if passed, the transformation will use a
paramaterized stylesheet to perform the transformation
bObject – if true this method returns a document instead of a string.
Returns:
the result of the transformation
Copyright © 200div class="indent">
strQuery – an XPath query such as: //somenode[@id='12']/somechild.
strNS – the selection namespace to use just for this query. This parameter is an optional
shortcut for calling setSelectionNamespaces() on the owning document. The format of this parameter
as a string is "xmlns:ns1='uri1' xmlns:ns2='uri2'" or as an object is {'uri1':'ns1',
'uri2':'ns2'}.
Returns:
jsx3.xml.Entity instance or null
Sets the @strValue of the named @strAttribute and binds as child of this
Parameters:
strName – name of the attribute
strValue – value of the attribute, if null then remove the attribute
Returns:
reference to this
Sets the attribute object as a child of the element; if transferring an attribute from one element to another, this call must be preceded with removeAttributeNode on the previous owner
Parameters:
objAtt – jsx3.xml.Entity instance of type jsx3.xml.Entity.TYPEATTRIBUTE;
Returns:
reference to this
sets the text value for this entity; returns a handle to this jsx3.xml.Entity instance
Parameters:
strValue – value to set for this entity
Returns:
self
Returns the XML (as String) for this node and any descendants. For an attribute this would be the
attribute name and value (i.e., name="value")
Returns:
Overrides:
performs an XSLT transformation, using @objEntityFilter as the XSLT filter for the transformation; returns
results of the transformation as a string (of text/html/xml/etc)
Parameters:
objEntityFilter – jsx3.xml.Entity instance containing the XSLT document to transform 'this' jsx3.xml.Entity instance with
objParams – JavaScript object array of name/value pairs; if passed, the transformation will use a
paramaterized stylesheet to perform the transformation
bObject – if true this method returns a document instead of a string.
Returns:
the result of the transformation
Copyright © 2001-2007, TIBCO Software Inc.