scala/ScalaBook/chapter-05/xml2.scala

import scala.xml._
import scala.xml.dtd._

//val x = XML.loadFile("listdir.html")

var z =  
     <svg width="100%" height="100%" version="1.1"
     xmlns="http://www.w3.org/2000/svg">
    <circle cx="100" cy="50" r="40" stroke="black"
     stroke-width="2" fill="red"/>
    </svg>



val doctype = DocType("svg",
                     PublicID(
                       "-//W3C//DTD SVG 1.1//EN",
                       "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"), 
                     Nil)

XML.saveFull("circle.svg", z, "UTF-8", true, doctype)


//<?xml version="1.0" standalone="no"?>
//<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
//"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">