Interface E4XXMLFunctions

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addNamespace​(E4XNamespace namespace)
      function addNamespace(namespace) adds a namespace declaration to the in scope namespaces for this XML object and returns this XML object.
      E4XXML appendChild​(E4XXML xml)
      function appendChild(xml) appends the given child to the end of this XML object's properties and returns this XML object.
      E4XXMLList attribute​(JSString attributeName)
      function attribute(attributeName) finds list of XML attributes associated with the attribute name.
      E4XXMLList attributes()
      function attributes() list of XML attributes associated with an XML object.
      E4XXMLList child​(JSNumber propertyName)
      function child(propertyName) finds list of XML object matching a given propertyName.
      E4XXMLList child​(JSString propertyName)
      function child(propertyName) finds list of XML object matching a given propertyName.
      JSNumber childIndex()
      function childIndex() returns the index position of the XML element.
      E4XXMLList children()
      function children() returns list of children for the XML element.
      E4XXMLList comments()
      function comments() returns list of comments for the XML element.
      JSBoolean contains​(E4XXML value)
      function contains(value) returns the result of comparing this XML object with the given value.
      JSBoolean contains​(E4XXMLList value)
      function contains(value) returns the result of comparing this XML object with the given value.
      JSBoolean copy()
      function copy() returns a deep copy of the XML object.
      E4XXMLList descendants​(JSString name)
      function descendants(name) returns all the XML valued descendants (children, grandchildren, great-grandchildren, etc.)
      E4XXMLList elements​(JSString name)
      function elements(name) returns the child elements.
      JSBoolean hasComplexContent()
      function hasComplexContent() a Boolean value indicating whether this XML object contains complex content.
      JSBoolean hasSimpleContent()
      function hasSimpleContent() a Boolean value indicating whether this XML object contains simple content.
      JSArray inScopeNamespaces()
      function inScopeNamespaces() returns an array of Namespace objects representing the namespaces in scope for this object.
      E4XXML insertChildAfter​(E4XXML child1, E4XXML child2)
      function insertChildAfter( child1 , child2) inserts the given child2 after the given child1 in this XML object and returns this XML object.
      E4XXML insertChildBefore​(E4XXML child1, E4XXML child2)
      function insertChildBefore( child1 , child2) inserts the given child2 before the given child1 in this XML object and returns this XML object.
      JSNumber length()
      function length() the length method always returns the integer 1 for XML objects.
      JSNumber localName()
      function localName() returns the localName part of the XML object.
      E4XQName name()
      function name() returns qualified name for the XML object.
      E4XNamespace namespace​(JSString prefix)
      function namespace(prefix) returns the namespace associated with this object.
      JSArray namespaceDeclarations()
      function namespaceDeclarations() returns a string representing the kind of object this is (e.g.
      JSString nodeKind()
      function nodeKind() return an array of Namespace objects representing the namespace declarations associated with this object.
      E4XXML normalize()
      function normalize() puts all text nodes in this and all descendant XML objects into a normal form by merging adjacent text nodes and eliminating empty text nodes.
      E4XXML parent()
      function parent() returns the parent of this XML object.
      E4XXML prependChild​(E4XXML value)
      function prependChild(value) adds a new child to an element, prior to all other children.
      E4XXMLList processingInstructions​(JSString name)
      function processingInstructions(name) A list of all processing instructions that are children of this element.
      E4XXML removeNamespace​(E4XNamespace namespace)
      function removeNamespace(namespace) removes a namespace from the in-scope namespaces of the element.
      E4XXML replace​(JSNumber propertyName, JSObject value)
      function replace(propertyName, value) replaces the XML properties of this XML object specified by propertyName with value and returns this XML object.
      E4XXML replace​(JSString propertyName, JSObject value)
      function replace(propertyName, value) replaces the XML properties of this XML object specified by propertyName with value and returns this XML object.
      E4XXML setChildren​(E4XXML value)
      function setChildren(value) replaces the XML properties of this XML object with a new set of XML properties from value.
      E4XXML setChildren​(E4XXMLList value)
      function setChildren(value) replaces the XML properties of this XML object with a new set of XML properties from value.
      void setLocalName​(JSString name)
      function setLocalName(name) replaces the local name of this XML object with a string constructed from the given name.
      void setName​(E4XQName name)
      function setName(name) sets the name of the XML object to the requested value (possibly qualified).
      void setNamespace​(E4XNamespace namespace)
      function setNamespace(namespace) sets the namespace of the XML object to the requested value.
      E4XXMLList text()
      function text() returns an XMLList containing all XML properties of this XML object that represent XML text nodes.
      JSString toXMLString()
      function toXMLString() returns the toXMLString() method returns an XML encoded string representation of this XML object.
    • Method Detail

      • addNamespace

        void addNamespace​(E4XNamespace namespace)
        function addNamespace(namespace) adds a namespace declaration to the in scope namespaces for this XML object and returns this XML object.
        Parameters:
        namespace - The namespace to be added.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • appendChild

        E4XXML appendChild​(E4XXML xml)
        function appendChild(xml) appends the given child to the end of this XML object's properties and returns this XML object.

        Example

         var e = <employees>
         	  <employee id="0" ><name>Jim</name><age>25</age></employee>
         	  <employee id="1" ><name>Joe</name><age>20</age></employee>
         	</employees>;
         // Add a new child element to the end of Jim's employee element
         e.employee.(name == "Jim").appendChild(<hobby>snorkeling</hobby>);
         
        Parameters:
        xml - to be appended.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • attribute

        E4XXMLList attribute​(JSString attributeName)
        function attribute(attributeName) finds list of XML attributes associated with the attribute name.

        Example

         // get the id of the employee named Jim
         e.employee.(name == "Jim").attribute("id");
         
        Parameters:
        attributeName - name of attribute to find.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • attributes

        E4XXMLList attributes()
        function attributes() list of XML attributes associated with an XML object.

        Example

         // print the attributes of an XML object
          function printAttributes(x) {
           for each (var a in x.attributes()) {
             print("The attribute named " + a.name() + " has the value " + a);
           }
          }
         
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • child

        E4XXMLList child​(JSString propertyName)
        function child(propertyName) finds list of XML object matching a given propertyName.

        Example

         var name = customer.child("name"); // equivalent to: var name = customer.name;
         var secondChild = customer.child(1); // equivalent to: var secondChild = customer.*[1]
         
        Parameters:
        propertyName - name of XML element to find.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • child

        E4XXMLList child​(JSNumber propertyName)
        function child(propertyName) finds list of XML object matching a given propertyName.

        Example

         var name = customer.child("name"); // equivalent to: var name = customer.name;
         var secondChild = customer.child(1); // equivalent to: var secondChild = customer.*[1]
         
        Parameters:
        propertyName - name of XML element to find.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • childIndex

        JSNumber childIndex()
        function childIndex() returns the index position of the XML element.

        Example

         // Get the ordinal index of the employee named Joe.
         var joeindex = e.employee.(name == "Joe").childIndex();
         
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • children

        E4XXMLList children()
        function children() returns list of children for the XML element.

        Example

         // Get child elements of first employee: returns an XMLList containing:
         // Jim, 25 and Snorkeling
         var employees = e.employee[0].children();
         
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • comments

        E4XXMLList comments()
        function comments() returns list of comments for the XML element.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • contains

        JSBoolean contains​(E4XXML value)
        function contains(value) returns the result of comparing this XML object with the given value.
        Parameters:
        value - XML object to test.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • contains

        JSBoolean contains​(E4XXMLList value)
        function contains(value) returns the result of comparing this XML object with the given value.
        Parameters:
        value - XMLList object to test.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • copy

        JSBoolean copy()
        function copy() returns a deep copy of the XML object.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • descendants

        E4XXMLList descendants​(JSString name)
        function descendants(name) returns all the XML valued descendants (children, grandchildren, great-grandchildren, etc.)
        Parameters:
        name - optional parameter to identity the decendants. If omitted all decendants are returned.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • elements

        E4XXMLList elements​(JSString name)
        function elements(name) returns the child elements.
        Parameters:
        name - optional parameter to identity the element. If omitted all children are returned.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • hasComplexContent

        JSBoolean hasComplexContent()
        function hasComplexContent() a Boolean value indicating whether this XML object contains complex content.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • hasSimpleContent

        JSBoolean hasSimpleContent()
        function hasSimpleContent() a Boolean value indicating whether this XML object contains simple content.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • inScopeNamespaces

        JSArray inScopeNamespaces()
        function inScopeNamespaces() returns an array of Namespace objects representing the namespaces in scope for this object.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • insertChildAfter

        E4XXML insertChildAfter​(E4XXML child1,
                                E4XXML child2)
        function insertChildAfter( child1 , child2) inserts the given child2 after the given child1 in this XML object and returns this XML object. If child1 is null, the insertChildAfter method inserts child2 before all children of this XML object (i.e., after none of them). If child1 does not exist in this XML object, it returns without modifying this XML object.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • insertChildBefore

        E4XXML insertChildBefore​(E4XXML child1,
                                 E4XXML child2)
        function insertChildBefore( child1 , child2) inserts the given child2 before the given child1 in this XML object and returns this XML object. If child1 is null, the insertChildBefore method inserts child2 after all children in this XML object (i.e., before none of them). If child1 does not exist in this XML object, it returns without modifying this XML object.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • length

        JSNumber length()
        function length() the length method always returns the integer 1 for XML objects.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • localName

        JSNumber localName()
        function localName() returns the localName part of the XML object.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • name

        E4XQName name()
        function name() returns qualified name for the XML object.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • namespace

        E4XNamespace namespace​(JSString prefix)
        function namespace(prefix) returns the namespace associated with this object.
        Parameters:
        prefix - optional prefix identifier
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • namespaceDeclarations

        JSArray namespaceDeclarations()
        function namespaceDeclarations() returns a string representing the kind of object this is (e.g. "element").
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • nodeKind

        JSString nodeKind()
        function nodeKind() return an array of Namespace objects representing the namespace declarations associated with this object.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • normalize

        E4XXML normalize()
        function normalize() puts all text nodes in this and all descendant XML objects into a normal form by merging adjacent text nodes and eliminating empty text nodes.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • parent

        E4XXML parent()
        function parent() returns the parent of this XML object.

        Example

         // Get the parent element of the second name in "e". Returns <employee id="1" ...
         var firstNameParent = e..name[1].parent();
         
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • processingInstructions

        E4XXMLList processingInstructions​(JSString name)
        function processingInstructions(name) A list of all processing instructions that are children of this element.
        Parameters:
        name - optional node name filter.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • prependChild

        E4XXML prependChild​(E4XXML value)
        function prependChild(value) adds a new child to an element, prior to all other children.

        Example

         // Add a new child element to the front of John's employee element
         e.employee.(name == "John").prependChild(<prefix>Mr.</prefix>);
         
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • removeNamespace

        E4XXML removeNamespace​(E4XNamespace namespace)
        function removeNamespace(namespace) removes a namespace from the in-scope namespaces of the element.
        Parameters:
        namespace - to remove
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • replace

        E4XXML replace​(JSString propertyName,
                       JSObject value)
        function replace(propertyName, value) replaces the XML properties of this XML object specified by propertyName with value and returns this XML object. If this XML object contains no properties that match propertyName, the replace method returns without modifying this XML object. The propertyName parameter may be a numeric property name, an unqualified name for a set of XML elements, a qualified name for a set of XML elements or the properties wildcard "*". When the propertyName parameter is an unqualified name, it identifies XML elements in the default namespace. The value parameter may be an XML object, XMLList object or any value that may be converted to a String with ToString().

        Example

         // Replace the first employee record with an open staff requisition
         employees.replace(0, <requisition status="open"/>);
         // Replace all item elements in the order with a single empty item
         order.replace("item", <item/>);
         
        Parameters:
        propertyName - name of property to replace.
        value - XML, XMLList or any other object (that can be converted using ToString()) to insert.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • replace

        E4XXML replace​(JSNumber propertyName,
                       JSObject value)
        function replace(propertyName, value) replaces the XML properties of this XML object specified by propertyName with value and returns this XML object. If this XML object contains no properties that match propertyName, the replace method returns without modifying this XML object. The propertyName parameter may be a numeric property name, an unqualified name for a set of XML elements, a qualified name for a set of XML elements or the properties wildcard "*". When the propertyName parameter is an unqualified name, it identifies XML elements in the default namespace. The value parameter may be an XML object, XMLList object or any value that may be converted to a String with ToString().

        Example

         // Replace the first employee record with an open staff requisition
         employees.replace(0, <requisition status="open"/>);
         // Replace all item elements in the order with a single empty item
         order.replace("item", <item/>);
         
        Parameters:
        propertyName - number index to replace.
        value - XML, XMLList or any other object (that can be converted using ToString()) to insert.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • setChildren

        E4XXML setChildren​(E4XXML value)
        function setChildren(value) replaces the XML properties of this XML object with a new set of XML properties from value. value may be a single XML object or an XMLList. setChildren returns this XML object.

        Example

         // Replace the entire contents of Jim's employee element
         employees.replace(0, <requisition status="open"/>);
         e.employee.(name == "Jim").setChildren(<name>John</name> + <age>35</age>);
         
        Parameters:
        value - new XML to set.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • setChildren

        E4XXML setChildren​(E4XXMLList value)
        function setChildren(value) replaces the XML properties of this XML object with a new set of XML properties from value. value may be a single XML object or an XMLList. setChildren returns this XML object.

        Example

         // Replace the entire contents of Jim's employee element
         employees.replace(0, <requisition status="open"/>);
         e.employee.(name == "Jim").setChildren(<name>John</name> + <age>35</age>);
         
        Parameters:
        value - new XMLList to set.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • setLocalName

        void setLocalName​(JSString name)
        function setLocalName(name) replaces the local name of this XML object with a string constructed from the given name.
        Parameters:
        name - to set for the XML element.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • setName

        void setName​(E4XQName name)
        function setName(name) sets the name of the XML object to the requested value (possibly qualified).
        Parameters:
        name - qualified name to set.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • setNamespace

        void setNamespace​(E4XNamespace namespace)
        function setNamespace(namespace) sets the namespace of the XML object to the requested value.
        Parameters:
        namespace - to set.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • text

        E4XXMLList text()
        function text() returns an XMLList containing all XML properties of this XML object that represent XML text nodes.
        Returns:
        concatenation of all text node children as a list.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML
      • toXMLString

        JSString toXMLString()
        function toXMLString() returns the toXMLString() method returns an XML encoded string representation of this XML object. Unlike the toString method, toXMLString provides no special treatment for XML objects that contain only XML text nodes (i.e., primitive values). The toXMLString method always includes the start tag, attributes and end tag of the XML object regardless of its content. It is provided for cases when the default XML to string conversion rules are not desired.
        Returns:
        Serializes this XML object as parseable XML.
        Since:
        Standard ECMA-357 2nd. Edition
        See Also:
        XML