diff options
author | Burak Emir <emir@epfl.ch> | 2006-05-23 07:54:44 +0000 |
---|---|---|
committer | Burak Emir <emir@epfl.ch> | 2006-05-23 07:54:44 +0000 |
commit | 911ce1e4a590ac40282857d7889aa297a211b588 (patch) | |
tree | 45826a27e727fe59dd8b9f19a78997643c66fda5 /src/library | |
parent | eec07f743193f9a7b34c0f89648a68a4cd7e72fc (diff) | |
download | scala-911ce1e4a590ac40282857d7889aa297a211b588.tar.gz scala-911ce1e4a590ac40282857d7889aa297a211b588.tar.bz2 scala-911ce1e4a590ac40282857d7889aa297a211b588.zip |
generalized save(.,.) method, encoding, write x...
generalized save(.,.) method, encoding, write xmldecl, write doctype
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/xml/XML.scala | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/library/scala/xml/XML.scala b/src/library/scala/xml/XML.scala index b715c35c71..b61f94772b 100644 --- a/src/library/scala/xml/XML.scala +++ b/src/library/scala/xml/XML.scala @@ -70,17 +70,17 @@ object XML { load(new StringReader(string)) /** saves XML to filename with encoding ISO-8859-1. Does not write an xml-decl or doctype. */ - final def save(filename: String, doc: Elem): Unit = + final def save(filename: String, doc: Node): Unit = save(filename, doc, "ISO-8859-1"); /** saves XML to filename with given encoding. Does not write an xml-decl or doctype. */ - final def save(filename: String, doc: Elem, enc: String): Unit = + final def save(filename: String, doc: Node, enc: String): Unit = saveFull(filename, doc, enc, false, null); - final def saveFull(filename: String, doc: Document, xmlDecl: Boolean, doctype: dtd.DocType): Unit = + final def saveFull(filename: String, doc: Node, xmlDecl: Boolean, doctype: dtd.DocType): Unit = saveFull(filename, doc, "ISO-8859-1", xmlDecl, doctype); - final def saveFull(filename: String, doc: Document, enc: String, xmlDecl: Boolean, doctype: dtd.DocType): Unit = { + final def saveFull(filename: String, doc: Node, enc: String, xmlDecl: Boolean, doctype: dtd.DocType): Unit = { /* using NIO classes of JDK 1.4 */ import java.io.{FileOutputStream,Writer}; import java.nio.channels.{Channels,FileChannel}; @@ -91,7 +91,7 @@ object XML { /* 2do: optimize by giving writer parameter to toXML*/ if(xmlDecl) w.write( "<?xml version='1.0' encoding='"+enc+"'?>\n"); if(doctype!=null) w.write( doctype.toString()+"\n"); - w.write( Utility.toXML( doc.docElem )); + w.write( Utility.toXML( doc )); w.close(); fos.close(); |