Node.appendChild(options)
Method Description |
Appends a node after the last child node of a specific element node. Returns the new child node. |
Returns |
|
Supported Script Types |
Client and server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Since |
2015.2 |
Parameters
The options parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
---|---|---|---|
|
required |
xml.Node object to append. |
Errors
Error Code |
Message |
Thrown If |
---|---|---|
|
HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted. |
Node cannot be appended. |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/xml Module Script Samples.
//Add additional code
...
var bookShelf = xml.Parser.fromString(file.load('SuiteScripts/books.xml').getContents());
var newBookNode = xmlData.createElement("book");
var newTitleNode = xmlData.createElement("title");
var newTitleNodeValue = xmlData.createTextNode("");
var newAuthorNode = xmlData.createElement("author");
var newAuthorNodeValue = xmlData.createTextNode("");
newTitleNode.appendChild(newTitleNodeValue);
newAuthorNode.appendChild(newAuthorNodeValue);
newBookNode.appendChild(newTitleNode);
newBookNode.appendChild(newAuthorNode);
var newbook = bookShelf.appendChild({
newChild : newBookNode
});
...
//Add additional code