Scoped XMLDocument2 - createElementWithTextValue(String name, String value)

Creates and adds an element node with a text child node to the current node.

Table 1. Parameters
Name Type Description
name String Name of the element to be added.
value String The added element's text value.
Table 2. Returns
Type Description
XMLNode The current node.
var xmlString = "<test>" +
                "  <one>" +
                "    <two att=\"xxx\">abcd1234</two>" +
                "    <three boo=\"yah\" att=\"yyy\">1234abcd</three>" +
                "    <two>another</two>" +
                "  </one>" +
                "  <number>1234</number>" +
                "</test>";
var xmlDoc = new XMLDocument2();
xmlDoc.parseXML(xmlString); 
xmlDoc.createElement("new", "test");
gs.info(xmlDoc);
Output:
<?xml version="1.0" encoding="UTF-8"?>
    <test>
        <one>
            <two att="xxx">abcd1234</two>    
            <three att="yyy" boo="yah">1234abcd</three>    
            <two>another</two>  
        </one>  
        <number>1234</number>
        <new>test</new>
    </test>