changeset 36686 | b1956bc8f585 |
parent 36016 | 4f5c7a19ebe0 |
child 36817 | ed97e877ff2d |
--- a/src/Pure/General/xml.scala Thu May 06 21:02:34 2010 +0200 +++ b/src/Pure/General/xml.scala Thu May 06 22:54:25 2010 +0200 @@ -92,6 +92,12 @@ } } + def content_length(tree: XML.Tree): Int = + tree match { + case Elem(_, _, body) => (0 /: body)(_ + content_length(_)) + case Text(s) => s.length + } + /* cache for partial sharing -- NOT THREAD SAFE */