Gambas Documentation - /comp/gb.xml/xmlelement/appendfromtext

/comp/gb.xml/xmlelement/appendfromtext

# XmlElement.AppendFromText (gb.xml)

Sub AppendFromText ( Data As String, Arguments As , ... )

This function parses the given Data, and adds all the found nodes to the end of the list of children of this element.

This method is very useful and faster if you want to add a lot of static nodes (i.e. if they are always the same) to an element, without using thousand of lines of code with the standard DOM interface.

This method is a faster way to do :

    Dim element As New XmlElement("foo")

    element.AppendChildren(XmlElement.FromText(Data))

Even if this method is optimized, the needed ressources increases with node count, so beware if you use it in a loop !

### Examples

    Dim element As New XmlElement("foo")

    Print element.Children.Count 'Shows 0

    element.AppendFromText("<p>Hello world ! <br /> This is a sample of text, <strong>very long and very boring</strong></p><a href='nowhere'> Clock here to avoid it</a>")

    Print element.Children.Count 'Shows 2

### See also

- AppendChild,

- AppendChildren,

- FromText