### Set Standalone Property

To set the property standalone, a Java API method is used (requires the JavaObject library).
In addition a map is needed to set the the property to yes.
Code Example 1
...
SetStandalone(x, True)
props.Put("standalone", "yes")
...
`Sub SetStandalone(x As XMLBuilder, b As Boolean)
Dim joXML As JavaObject = x
joXML.RunMethodJO("getDocument", Null).RunMethod("setXmlStandalone", Array(b))
End Sub`
Result:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
Code Example 2
`Sub XMLCreateNames2
Dim x As XMLBuilder
x = x.create("Names").attribute("xmlns", "List of Names")
Dim s As String
For i = 1 To 3
s = s & "Name " & i
x = x.element("Name"&i).element("Name").text(s).up().up()
Next
Dim props As Map
props.Initialize
props.Put("{http://xml.apache.org/xslt}indent-amount", "2")
props.Put("indent", "yes")
SetStandalone(x, True)
props.Put("standalone", "yes")
Log(x.asString2(props))
End Sub`
`Sub SetStandalone(x As XMLBuilder, b As Boolean)
Dim joXML As JavaObject = x
joXML.RunMethodJO("getDocument", Null).RunMethod("setXmlStandalone", Array(b))
End Sub`
Result:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Names xmlns="List of Names">
<Name1>
<Name>Name 1</Name>
</Name1>
<Name2>
<Name>Name 1Name 2</Name>
</Name2>
<Name3>
<Name>Name 1Name 2Name 3</Name>
</Name3>
</Names>

Changed: , Category: XMLBuilder, File: T6C286M2145.htm, ID: 2145