public interface E4XXMLFunctions extends JSObjectFunctions
hasOwnProperty| Modifier and Type | Method and 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.
|
hasOwnProperty, isPrototypeOf, propertyIsEnumerable, toLocaleString, toString, valueOfvoid addNamespace(E4XNamespace namespace)
name - The namespace to be added.XMLE4XXML appendChild(E4XXML xml)
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>);
xml - to be appended.XMLE4XXMLList attribute(JSString attributeName)
Example
// get the id of the employee named Jim
e.employee.(name == "Jim").attribute("id");
attributeName - name of attribute to find.XMLE4XXMLList attributes()
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);
}
}
XMLE4XXMLList child(JSString propertyName)
Example
var name = customer.child("name"); // equivalent to: var name = customer.name;
var secondChild = customer.child(1); // equivalent to: var secondChild = customer.*[1]
propertyName - name of XML element to find.XMLE4XXMLList child(JSNumber propertyName)
Example
var name = customer.child("name"); // equivalent to: var name = customer.name;
var secondChild = customer.child(1); // equivalent to: var secondChild = customer.*[1]
propertyName - name of XML element to find.XMLJSNumber childIndex()
Example
// Get the ordinal index of the employee named Joe. var joeindex = e.employee.(name == "Joe").childIndex();
XMLE4XXMLList children()
Example
// Get child elements of first employee: returns an XMLList containing: //Jim ,25 andSnorkeling var emps = e.employee[0].children();
XMLE4XXMLList comments()
XMLJSBoolean contains(E4XXML value)
value - XML object to test.XMLJSBoolean contains(E4XXMLList value)
value - XMLList object to test.XMLJSBoolean copy()
XMLE4XXMLList descendants(JSString name)
name - optional parameter to identity the decendants. If omitted all decendants are returned.XMLE4XXMLList elements(JSString name)
name - optional parameter to identity the element. If omitted all children are returned.XMLJSBoolean hasComplexContent()
XMLJSBoolean hasSimpleContent()
XMLJSArray inScopeNamespaces()
XMLE4XXML insertChildAfter(E4XXML child1, E4XXML child2)
XMLE4XXML insertChildBefore(E4XXML child1, E4XXML child2)
XMLJSNumber length()
XMLJSNumber localName()
XMLE4XQName name()
XMLE4XNamespace namespace(JSString prefix)
prefix - optional prefix identifierXMLJSArray namespaceDeclarations()
XMLJSString nodeKind()
XMLE4XXML normalize()
XMLE4XXML parent()
Example
// Get the parent element of the second name in "e". Returns <employee id="1" ...
var firstNameParent = e..name[1].parent();
XMLE4XXMLList processingInstructions(JSString name)
name - optional node name filter.XMLE4XXML prependChild(E4XXML value)
Example
// Add a new child element to the front of John's employee element
e.employee.(name == "John").prependChild( <prefix>Mr.</prefix>);
XMLE4XXML removeNamespace(E4XNamespace namespace)
namespace - to removeXMLE4XXML replace(JSString propertyName, JSObject value)
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/>);
propertyName - name of property to replace.value - XML, XMLList or any other object (that can be converted using ToString()) to insert.XMLE4XXML replace(JSNumber propertyName, JSObject value)
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/>);
propertyName - number index to replace.value - XML, XMLList or any other object (that can be converted using ToString()) to insert.XMLE4XXML setChildren(E4XXML value)
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>);
value - new XML to set.XMLE4XXML setChildren(E4XXMLList value)
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>);
value - new XMLList to set.XMLvoid setLocalName(JSString name)
name - to set for the XML element.XMLvoid setName(E4XQName name)
name - qualified name to set.XMLvoid setNamespace(E4XNamespace namespace)
namespace - to set.XMLE4XXMLList text()
XMLJSString toXMLString()
XML