diff options
author | buraq <buraq@epfl.ch> | 2003-12-08 15:40:10 +0000 |
---|---|---|
committer | buraq <buraq@epfl.ch> | 2003-12-08 15:40:10 +0000 |
commit | 2d473fd67a7999d823ad5be9de3d5c5c59d0e40f (patch) | |
tree | a3ed9cd22dc263bf644a43bb0f48b2856d292e41 /sources | |
parent | 1935bd3e5387b29478f2659b10bacedc26b847fb (diff) | |
download | scala-2d473fd67a7999d823ad5be9de3d5c5c59d0e40f.tar.gz scala-2d473fd67a7999d823ad5be9de3d5c5c59d0e40f.tar.bz2 scala-2d473fd67a7999d823ad5be9de3d5c5c59d0e40f.zip |
indenting + slight changes because of Element-S...
indenting + slight changes because of Element-Symbol migration
Diffstat (limited to 'sources')
-rw-r--r-- | sources/scala/xml/Utility.scala | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/sources/scala/xml/Utility.scala b/sources/scala/xml/Utility.scala index 7a76f819fe..0f7528afc7 100644 --- a/sources/scala/xml/Utility.scala +++ b/sources/scala/xml/Utility.scala @@ -24,22 +24,23 @@ object Utility { } /** serializes an instance of Node to a string that contains well-formed XML **/ - def toXML( n:Node ):String = n match { - case Text( t ) => escape( t ); + def toXML( n:Node ):String = { n match { + case Text( t ) => + escape( t ); case x:AttributedNode => - val s = new StringBuffer(); - s.append("<"); - s.append( x.label ); - if( null != x.attributes ) { - s.append( attr2xml( x.attributes.elements ) );{} - } - s.append(">"); - s.append( toXML( x.children.elements ) ); - s.append("</"); - s.append( x.label ); - s.append(">"); - s.toString() - } + val s = new StringBuffer(); + s.append("<"); + s.append( x.label ); + if( null != x.attributes ) { + s.append( attr2xml( x.attributes.elements ) );{} + } + s.append(">"); + s.append( toXML( x.children.elements ) ); + s.append("</"); + s.append( x.label ); + s.append(">"); + s.toString() + }} def toXML( ch:Iterator[Node] ):String = { ch.foldLeft ("") { (s:String,n:Node) => { val t:String = toXML( n ); s + t }} |