Searching the Help
To search for information in the Help, type a word or phrase in the Search box. When you enter a group of words, OR is inferred. You can use Boolean operators to refine your search.
Results returned are case insensitive. However, results ranking takes case into account and assigns higher scores to case matches. Therefore, a search for "cats" followed by a search for "Cats" would return the same number of Help topics, but the order in which the topics are listed would be different.
Search for | Example | Results |
---|---|---|
A single word | cat
|
Topics that contain the word "cat". You will also find its grammatical variations, such as "cats". |
A phrase. You can specify that the search results contain a specific phrase. |
"cat food" (quotation marks) |
Topics that contain the literal phrase "cat food" and all its grammatical variations. Without the quotation marks, the query is equivalent to specifying an OR operator, which finds topics with one of the individual words instead of the phrase. |
Search for | Operator | Example |
---|---|---|
Two or more words in the same topic |
|
|
Either word in a topic |
|
|
Topics that do not contain a specific word or phrase |
|
|
Topics that contain one string and do not contain another | ^ (caret) |
cat ^ mouse
|
A combination of search types | ( ) parentheses |
|
- JavaScript object: XML
- JavaScript method: XML.addAttribute()
- JavaScript method: XML.addElement()
- JavaScript method: XML.appendNode()
- JavaScript method: XML.createNode()
- JavaScript method: XML.getAttributeNode()
- JavaScript method: XML.getAttributeValue()
- JavaScript method: XML.getDocumentElement()
- JavaScript method: XML.getFirstAttribute()
- JavaScript method: XML.getFirstChildElement()
- JavaScript method: XML.getName()
- JavaScript method: XML.getNextAttribute()
- JavaScript method: XML.getNextSiblingElement()
- JavaScript method: XML.getNodeName()
- JavaScript method: XML.getNodeType()
- JavaScript method: XML.getNodeValue()
- JavaScript method: XML.getParentNode()
- JavaScript method: XML.getPrefix()
- JavaScript method: XML.getQualifiedName()
- JavaScript method: XML.getText()
- JavaScript method: XML.getValue()
- JavaScript method: XML.importNode()
- JavaScript method: XML.isDocumentElement()
- JavaScript method: XML.removeAttribute()
- JavaScript method: XML.setAttributeValue()
- JavaScript method: XML.setContent()
- JavaScript method: XML.setNodeValue()
- JavaScript method: XML.setText()
- JavaScript method: XML.setValue()
- JavaScript method: XML.toXMLString()
- JavaScript method: XMLDoc.insertBefore()
JavaScript method: xmlDoc.insertBefore()
Inserts the specified node before a reference element as a child of the current node.
Syntax
var insertedElement = parentElement.insertBefore(newElement, referenceElement)
Arguments
The following arguments are valid for this function:
Name | Data type | Required | Description |
---|---|---|---|
insertedElement | XML | Yes | The node being inserted, that is newElement . |
parentElement | XML | Yes | The parent of the newly inserted node. |
newElement | XML | Yes | The node to insert. |
referenceElement | XML | Yes | The parent of the newly inserted node. |
Usage Notes
- The
referenceElement
may NOT be null. IfreferenceElement
is null,newElement
the function will fail. - The
newElement
must be a newly created element within the same document (created using importNode or createNode) which has not yet been attached to the tree, such as a newly created element for which appendNode has not been called. The result of invokinginsertBefore
using references to nodes already in the same DOM tree asnewElement
is undefined.
Example
var xmlDoc = new XML(); var someXML = "<doc> \ <one/> \ <two/> \ </doc>"; // Create an XML document from the literal XML string // we pass "false" as the second argument to setContent() to indicate // that the supplied string does NOT represent a path to an XML file xmlDoc.setContent( someXML, false ); // Now add create and add new element <four> in one step. // It will be added at the end, i.e. after <two> var nodeFour = xmlDoc.addElement( "four" ); // Now insert a new element <three> in front of <four> // We do this in two steps: // a) create a new element node called <three> // b) insert the new element node before the <four> element // Note: Passing "1" as the first argument to createNode means create an element var nodeThree = xmlDoc.createNode( 1, "three" ); // The newly created node has not yet been given a position in the tree. // Just as in the case of a node created with "importNode", we must // attach the new node somewhere. We can do that with appendNode or insertBefore // To get the new node in between two sibling nodes (as in this example) // we must use insertBefore. appendChild can only be used on a parent node, // and if we were to append to the parent element <doc>, it would end up following <four> xmlDoc.insertBefore( nodeThree, nodeFour ); print( xmlDoc );