beautypg.com

Roxmllist – BrightSign BrightScript 2 Reference Guide User Manual

Page 50

background image

50

root.AddAttribute("key2","value2")
ne=root.AddBodyElement()
ne.SetName("sub")
ne.SetBody("this is the sub1 text")
ne=root.AddBodyElement()
ne.SetName("subelement2")
ne.SetBody("more sub text")
ne.AddAttribute("k","v")
ne=root.AddElement("subelement3")
ne.SetBody("more sub text 3")
root.AddElementWithBody("sub","another sub (#4)")

PrintXML(root, 0)
print root.GenXML(false)



Another Example

xml = CreateObject("roXMLElement")
xml.SetName("root")
subel1 = xml.AddBodyElement()
subel1.SetName("subelement1")
subel2 = xml.AddBodyElement()
subel2.SetName("subelement2")

Is the same as:

xml = CreateObject("roXMLElement")
xml.SetName("root")
subel1 = xml.AddElement("subelement1")
subel2 = xml.AddElement("subelement2")

roXMLList

Interfaces:

ifList (documented elsewhere)

ifXMLList

o GetAttributes() As Object
o GetText() As String
o GetChildElements() As Object
o GetNamedElements(As String) As Object
o Simplify() As Object

GetNamedElements() is used to return a new XMLList that contains all roXMLElements
that matched the passed in name. This is the same as using the dot operator on an
roXMLList.

Simplify will

Otherwise, Return an roXMLElement if the list contains exactly one

Otherwise, will return itself