Append element as child of Anti-XML element

vindoarga

New Member
Suppose I have an XML document stored as an Anti-XML \[code\]Elem\[/code\]:\[code\]val root : Elem = <foo attr="val"> <bar/> </foo>\[/code\]. I want to append \[code\]<baz>blahblahblah</baz>\[/code\] to the root element as a child, giving\[code\]val modified_root : Elem = <foo attr="val"> <bar/> <baz>blahblahblah</baz> </foo>\[/code\]For comparison, in Python you can just \[code\]root.append(foo)\[/code\].I know I can append (as a sibling) to a \[code\]Group[Node]\[/code\] using \[code\]:+\[/code\], but that's not what I want:\[code\]<foo attr="val"> <bar/></foo><baz>blahblahblah</baz>\[/code\]How do I append it as the last child of \[code\]<foo>\[/code\]? Looking at the documentation I see no obvious way.Similar to Scala XML Building: Adding children to existing Nodes, except this question is for Anti-XML rather than \[code\]scala.xml\[/code\].
 
Back
Top