added a simple builder API to the std.dom API

This commit is contained in:
James Strachan
2012-02-07 14:10:16 +00:00
parent a3cd65f10e
commit ef269a9f81
3 changed files with 92 additions and 5 deletions
+27
View File
@@ -0,0 +1,27 @@
package test.dom
import std.*
import std.dom.*
import stdhack.test.*
import org.w3c.dom.*
class DomBuilderTest() : TestSupport() {
fun testBuildDocumnet() {
var doc = createDocument()
doc.addElement("foo") {
id = "id1"
style = "bold"
cssClass = "bar"
addElement("child") {
cssClass = "another"
addElement("grandChild") {
cssClass = "tiny"
addText("Hello World!")
}
}
}
println("builder document: ${doc.toXmlString()}")
}
}