Package | impression.utilities |
Class | public class XMLUtils |
Inheritance | XMLUtils ![]() |
Method | Defined By | ||
---|---|---|---|
comparePositions(a:XML, b:XML):Number [static]
Identifies the relative position of two XML objects. | XMLUtils | ||
firstMatchingElementWithAttribute(source:XMLList, attributeName:String, value:*):XML [static]
Performs a traversal of the nodes of an XMLList object and returns the first element with a matching attribute value. | XMLUtils | ||
getAncestorArray(descendant:XML):Array [static]
Returns an array of ancestors for an XML object. | XMLUtils | ||
getAttribute(element:XML, attributeName:String, defaultValue:*):* [static]
Returns an attribute value from an XML object. | XMLUtils | ||
getBooleanAttribute(element:XML, attributeName:String, defaultValue:Boolean = false):Boolean [static]
Returns a Boolean representation of an attribute value from an XML object. | XMLUtils | ||
getCommonAncestor(descendant1:XML, descendant2:XML):XML [static]
Returns the common ancestor of two XML objects. | XMLUtils | ||
getFirstChild(source:XML):XML [static]
Returns the first child of an XML object. | XMLUtils | ||
getFirstSibling(source:XML):XML [static]
Returns the first sibling of an XML object. | XMLUtils | ||
getIntAttribute(element:XML, attributeName:String, defaultValue:int = 0):int [static]
Returns an int representation of an attribute value from an XML object. | XMLUtils | ||
getLastChild(source:XML):XML [static]
Returns the last child of an XML object. | XMLUtils | ||
getLastDescendant(source:XML):XML [static]
Returns the last descendant of an XML object. | XMLUtils | ||
getLastSibling(source:XML):XML [static]
Returns the last sibling of an XML object. | XMLUtils | ||
getNextLinear(source:XML):XML [static]
Returns the next linear element of an XML object. | XMLUtils | ||
getNextSibling(source:XML):XML [static]
Returns the next sibling of an XML object. | XMLUtils | ||
getNumberAttribute(element:XML, attributeName:String, defaultValue:Number = 0):Number [static]
Returns a Number representation of an attribute value from an XML object. | XMLUtils | ||
getPath(item:XML):String [static]
Returns a dot-seperated list of childIndex values of an XML object. | XMLUtils | ||
getPreviousLinear(source:XML):XML [static]
Returns the previous linear element of an XML object. | XMLUtils | ||
getPreviousSibling(source:XML):XML [static]
Returns the previous sibling of an XML object. | XMLUtils | ||
getRoot(source:XML):XML [static]
Returns the root element of an XML object. | XMLUtils | ||
getStringAttribute(element:XML, attributeName:String, defaultValue:String):String [static]
Returns a String representation of an attribute value from an XML object. | XMLUtils | ||
isAncestor(ancestor:XML, descendant:XML):Boolean [static]
Identifies whether an XML object is the ancestor of another XML object. | XMLUtils |
comparePositions | () | method |
public static function comparePositions(a:XML, b:XML):Number
Identifies the relative position of two XML objects.
This method returns a numeric value indicating the relative position, as described below.
a
is before b
in the XML tree, this method returns -1
.b
is before a
in the XML tree, this method returns 1
.a
or b
are null
, or do not share a common ancestor, this method returns 0
.a
and b
XML objects.
Parameters
a:XML — The first XML object to examine.
| |
b:XML — The second XML object to examine.
|
Number — A number identifying the relative position of a and b .
|
firstMatchingElementWithAttribute | () | method |
public static function firstMatchingElementWithAttribute(source:XMLList, attributeName:String, value:*):XML
Performs a traversal of the nodes of an XMLList object and returns the first element with a matching attribute value.
If list
is null
, or no matching element is found, null
is returned.
Parameters
source:XMLList — The XMLList to traverse.
| |
attributeName:String — The name of the attribute to check.
| |
value:* — The value of the attribute to match.
|
XML — The first XML object in the list where attributeName matches value .
|
getAncestorArray | () | method |
public static function getAncestorArray(descendant:XML):Array
Returns an array of ancestors for an XML object.
The array is sorted in ascending order; that is, the immediate parent of the
object is at array index 0, the grandparent is at array index 1, and so on. If
descendant
is null
, or is a root node, an empty array
is returned.
Parameters
descendant:XML — The XML object to return the ancestors of.
|
Array — An array containing the ancestors of descendant .
|
getAttribute | () | method |
public static function getAttribute(element:XML, attributeName:String, defaultValue:*):*
Returns an attribute value from an XML object.
If attributeName
is not found or an error occurs, defaultValue
will be returned.
Parameters
element:XML — The XML object to retrieve the attribute value from.
| |
attributeName:String — The name of the attribute.
| |
defaultValue:* — The default value to return if attributeName cannot be found or an error occurs.
|
* — The value of the attributeName attribute, or defaultValue .
|
getBooleanAttribute | () | method |
public static function getBooleanAttribute(element:XML, attributeName:String, defaultValue:Boolean = false):Boolean
Returns a Boolean representation of an attribute value from an XML object.
If attributeName
is not found or an error occurs, defaultValue
will be returned.
Parameters
element:XML — The XML object to retrieve the attribute value from.
| |
attributeName:String — The name of the attribute.
| |
defaultValue:Boolean (default = false ) — The default value to return if attributeName cannot be found or an error occurs.
|
Boolean — The value of the attributeName attribute, or defaultValue .
|
getCommonAncestor | () | method |
public static function getCommonAncestor(descendant1:XML, descendant2:XML):XML
Returns the common ancestor of two XML objects.
This method returns the "closest" common ancestor of the two objects.
If either descendant1
or descendant2
are null
, null
is returned. If there is no
common ancestor, null
is returned.
Parameters
descendant1:XML — The first XML object to examine.
| |
descendant2:XML — The second XML object to examine.
|
XML — The nearest common ancestor of descendant1 and descendant2 .
|
getFirstChild | () | method |
public static function getFirstChild(source:XML):XML
Returns the first child of an XML object.
If source
has no children, or if an error occurs, null
is returned.
Parameters
source:XML — The XML object to return the first child of.
|
XML — The first child of source .
|
getFirstSibling | () | method |
public static function getFirstSibling(source:XML):XML
Returns the first sibling of an XML object.
If source
is the first sibling, it is returned. If an error occurs, null
is returned.
Parameters
source:XML — The XML object to return the first sibling of.
|
XML — The first sibling of source .
|
getIntAttribute | () | method |
public static function getIntAttribute(element:XML, attributeName:String, defaultValue:int = 0):int
Returns an int representation of an attribute value from an XML object.
If attributeName
is not found or an error occurs, defaultValue
will be returned.
Parameters
element:XML — The XML object to retrieve the attribute value from.
| |
attributeName:String — The name of the attribute.
| |
defaultValue:int (default = 0 ) — The default value to return if attributeName cannot be found or an error occurs.
|
int — The value of the attributeName attribute, or defaultValue .
|
getLastChild | () | method |
public static function getLastChild(source:XML):XML
Returns the last child of an XML object.
If source
has no children, or if an error occurs, null
is returned.
Parameters
source:XML — The XML object to return the last child of.
|
XML — The last child of source .
|
getLastDescendant | () | method |
public static function getLastDescendant(source:XML):XML
Returns the last descendant of an XML object.
If source
has no children, or if an error occurs, null
is returned.
Parameters
source:XML — The XML object to return the last descendant of.
|
XML — The last descendant of source .
|
getLastSibling | () | method |
public static function getLastSibling(source:XML):XML
Returns the last sibling of an XML object.
If source
is the last sibling, it is returned. If an error occurs, null
is returned.
Parameters
source:XML — The XML object to return the first sibling of.
|
XML — The first sibling of source .
|
getNextLinear | () | method |
public static function getNextLinear(source:XML):XML
Returns the next linear element of an XML object.
If there is no next linear element, or an error occurs, null
is returned.
Parameters
source:XML — The XML object to return the next linear element of.
|
XML — The next linear element of source .
|
getNextSibling | () | method |
public static function getNextSibling(source:XML):XML
Returns the next sibling of an XML object.
If source
is the last sibling, or if an error occurs, null
is returned.
Parameters
source:XML — The XML object to return the next sibling of.
|
XML — The next sibling of source .
|
getNumberAttribute | () | method |
public static function getNumberAttribute(element:XML, attributeName:String, defaultValue:Number = 0):Number
Returns a Number representation of an attribute value from an XML object.
If attributeName
is not found or an error occurs, defaultValue
will be returned.
Parameters
element:XML — The XML object to retrieve the attribute value from.
| |
attributeName:String — The name of the attribute.
| |
defaultValue:Number (default = 0 ) — The default value to return if attributeName cannot be found or an error occurs.
|
Number — The value of the attributeName attribute, or defaultValue .
|
getPath | () | method |
public static function getPath(item:XML):String
Returns a dot-seperated list of childIndex values of an XML object.
If item
is null
, or is a root element, the empty string ("") is returned.
Parameters
item:XML — The XML object to return the path of.
|
String — A a dot-seperated list of childIndex values.
|
getPreviousLinear | () | method |
public static function getPreviousLinear(source:XML):XML
Returns the previous linear element of an XML object.
If there is no previous linear element, or an error occurs, null
is returned.
Parameters
source:XML — The XML object to return the previous linear element of.
|
XML — The previous linear element of source .
|
getPreviousSibling | () | method |
public static function getPreviousSibling(source:XML):XML
Returns the previous sibling of an XML object.
If source
is the first sibling, or if an error occurs, null
is returned.
Parameters
source:XML — The XML object to return the previous sibling of.
|
XML — The previous sibling of source .
|
getRoot | () | method |
public static function getRoot(source:XML):XML
Returns the root element of an XML object.
If source
is null
, or an error occurs, null
is returned.
Parameters
source:XML — The XML object to return the root of.
|
XML — The root element of source .
|
getStringAttribute | () | method |
public static function getStringAttribute(element:XML, attributeName:String, defaultValue:String):String
Returns a String representation of an attribute value from an XML object.
If attributeName
is not found or an error occurs, defaultValue
will be returned.
Parameters
element:XML — The XML object to retrieve the attribute value from.
| |
attributeName:String — The name of the attribute.
| |
defaultValue:String — The default value to return if attributeName cannot be found or an error occurs.
|
String — The value of the attributeName attribute, or defaultValue .
|
isAncestor | () | method |
public static function isAncestor(ancestor:XML, descendant:XML):Boolean
Identifies whether an XML object is the ancestor of another XML object.
Parameters
ancestor:XML — The XML object to use as an ancestor.
| |
descendant:XML — The XML object to check the ancestry of.
|
Boolean — true if ancestor is an ancestor of descendant .
|