Interface E4XXMLFunctions

All Superinterfaces:
JSObjectFunctions
All Known Implementing Classes:
E4XXML

public interface E4XXMLFunctions extends JSObjectFunctions
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    function addNamespace(namespace) adds a namespace declaration to the in scope namespaces for this XML object and returns this XML object.
    function appendChild(xml) appends the given child to the end of this XML object's properties and returns this XML object.
    attribute(JSString attributeName)
    function attribute(attributeName) finds list of XML attributes associated with the attribute name.
    function attributes() list of XML attributes associated with an XML object.
    child(JSNumber propertyName)
    function child(propertyName) finds list of XML object matching a given propertyName.
    child(JSString propertyName)
    function child(propertyName) finds list of XML object matching a given propertyName.
    function childIndex() returns the index position of the XML element.
    function children() returns list of children for the XML element.
    function comments() returns list of comments for the XML element.
    function contains(value) returns the result of comparing this XML object with the given value.
    function contains(value) returns the result of comparing this XML object with the given value.
    function copy() returns a deep copy of the XML object.
    function descendants(name) returns all the XML valued descendants (children, grandchildren, great-grandchildren, etc.)
    function elements(name) returns the child elements.
    function hasComplexContent() a Boolean value indicating whether this XML object contains complex content.
    function hasSimpleContent() a Boolean value indicating whether this XML object contains simple content.
    function inScopeNamespaces() returns an array of Namespace objects representing the namespaces in scope for this object.
    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.
    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.
    function length() the length method always returns the integer 1 for XML objects.
    function localName() returns the localName part of the XML object.
    function name() returns qualified name for the XML object.
    function namespace(prefix) returns the namespace associated with this object.
    function namespaceDeclarations() returns a string representing the kind of object this is (e.g.
    function nodeKind() return an array of Namespace objects representing the namespace declarations associated with this object.
    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.
    function parent() returns the parent of this XML object.
    function prependChild(value) adds a new child to an element, prior to all other children.
    function processingInstructions(name) A list of all processing instructions that are children of this element.
    function removeNamespace(namespace) removes a namespace from the in-scope namespaces of the element.
    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.
    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.
    function setChildren(value) replaces the XML properties of this XML object with a new set of XML properties from value.
    function setChildren(value) replaces the XML properties of this XML object with a new set of XML properties from value.
    void
    function setLocalName(name) replaces the local name of this XML object with a string constructed from the given name.
    void
    function setName(name) sets the name of the XML object to the requested value (possibly qualified).
    void
    function setNamespace(namespace) sets the namespace of the XML object to the requested value.
    function text() returns an XMLList containing all XML properties of this XML object that represent XML text nodes.
    function toXMLString() returns the toXMLString() method returns an XML encoded string representation of this XML object.

    Methods inherited from interface org.fife.rsta.ac.js.ecma.api.ecma3.functions.JSObjectFunctions

    hasOwnProperty, isPrototypeOf, propertyIsEnumerable, toLocaleString, toString, valueOf
  • Method Details

    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • comments

      E4XXMLList comments()
      function comments() returns list of comments for the XML element.
      Since:
      Standard ECMA-357 2nd. Edition
      See Also:
    • 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:
    • 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:
    • copy

      JSBoolean copy()
      function copy() returns a deep copy of the XML object.
      Since:
      Standard ECMA-357 2nd. Edition
      See Also:
    • 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:
    • 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:
    • hasComplexContent

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

      JSBoolean hasSimpleContent()
      function hasSimpleContent() a Boolean value indicating whether this XML object contains simple content.
      Since:
      Standard ECMA-357 2nd. Edition
      See Also:
    • 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:
    • 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:
    • 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:
    • length

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

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

      E4XQName name()
      function name() returns qualified name for the XML object.
      Since:
      Standard ECMA-357 2nd. Edition
      See Also:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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: