Question: XMLTools / generate XMLElement with strings

Is it possible to generate a XMLElement by using part of the code to be generated with a string, or are the only methods a strict use of AddAttribute and AddChild?

Hope the code below explains what I mean. The first line is a strict copy of a declaration in the help file.

The question is if I could use some part of the definition which is saved in the str variable and combine it into the first declaration?


 

with(XMLTools)

x := XMLElement("a", ["colour" = "red", "style" = "italic"], ["some content", XMLElement("b", ["colour" = "blue"], "more text"), "still more text"])

_XML_Element(_XML_ElementType("a"), [_XML_Attribute(_XML_AttrName("colour"), _XML_AttrValue("red")), _XML_Attribute(_XML_AttrName("style"), _XML_AttrValue("italic"))], [_XML_Text("some content"), _XML_Element(_XML_ElementType("b"), [_XML_Attribute(_XML_AttrName("colour"), _XML_AttrValue("blue"))], [_XML_Text("more text")]), _XML_Text("still more text")])

(1)

str := "["colour"="red","style"="italic"],["some content",XMLElement("b",["colour"="blue"],"more text"),"still more text"]"

"["colour"="red","style"="italic"],["some content",XMLElement("b",["colour"="blue"],"more text"),"still more text"]"

(2)

``


 

Download xml_string.mw

Please Wait...