Lasso Soft Inc. > Home

[ xml_node->appendchild ]

Method

The [xml_node->appendchild] method appends the supplied xml_node to the given xml_node

The method requires one parameter which is the xml_node to add. The supplied node becomes the last child of the node it is added to.

  • Syntax
xml_node->appendchild( 'new_xml_node' )
Examples
  • Beginner

Add a new child node to an existing xml_node

This example uses the [xml_node->appendchild] method to add a new 'vacation' node as the last child to the 'vacations' xml_node.

Code

var( vacations = xml('<vacations>
     <vacation day="23" month="March">
          <employee>Sean</employee>
     </vacation>
</vacations>') )

var( vacationDay = xml('<vacation day="14" month="March">
     <employee>Clive</employee>
</vacation>') )

$vacations->appendchild($vacationDay)

$vacations

Result

<vacations>
     <vacation day="23" month="March">
          <employee>Sean</employee>
     </vacation>
     <vacation day="14" month="March">
         <employee>Clive</employee>
     </vacation>
</vacations>

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft