@@ -194,22 +194,24 @@ object Utility extends AnyRef with parsing.TokenTests
194
194
minimizeTags : Boolean = false ): StringBuilder =
195
195
{
196
196
x match {
197
- case c : Comment if ! stripComments => c buildString sb
198
- case x : SpecialNode => x buildString sb
199
- case g : Group => for (c <- g.nodes) toXML(c, x.scope, sb) ; sb
197
+ case c : Comment => if (! stripComments) c buildString sb else sb
198
+ case x : SpecialNode => x buildString sb
199
+ case g : Group =>
200
+ g.nodes foreach {toXML(_, x.scope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags)}
201
+ sb
200
202
case _ =>
201
203
// print tag with namespace declarations
202
204
sb.append('<' )
203
205
x.nameToString(sb)
204
206
if (x.attributes ne null ) x.attributes.buildString(sb)
205
207
x.scope.buildString(sb, pscope)
206
- if (x.child.isEmpty && minimizeTags)
208
+ if (x.child.isEmpty && minimizeTags) {
207
209
// no children, so use short form: <xyz .../>
208
210
sb.append(" />" )
209
- else {
211
+ } else {
210
212
// children, so use long form: <xyz ...>...</xyz>
211
213
sb.append('>' )
212
- sequenceToXML(x.child, x.scope, sb, stripComments)
214
+ sequenceToXML(x.child, x.scope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags )
213
215
sb.append(" </" )
214
216
x.nameToString(sb)
215
217
sb.append('>' )
@@ -221,20 +223,23 @@ object Utility extends AnyRef with parsing.TokenTests
221
223
children : Seq [Node ],
222
224
pscope : NamespaceBinding = TopScope ,
223
225
sb : StringBuilder = new StringBuilder ,
224
- stripComments : Boolean = false ): Unit =
226
+ stripComments : Boolean = false ,
227
+ decodeEntities : Boolean = true ,
228
+ preserveWhitespace : Boolean = false ,
229
+ minimizeTags : Boolean = false ): Unit =
225
230
{
226
231
if (children.isEmpty) return
227
232
else if (children forall isAtomAndNotText) { // add space
228
233
val it = children.iterator
229
234
val f = it.next
230
- toXML(f, pscope, sb)
235
+ toXML(f, pscope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags )
231
236
while (it.hasNext) {
232
237
val x = it.next
233
238
sb.append(' ' )
234
- toXML(x, pscope, sb)
239
+ toXML(x, pscope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags )
235
240
}
236
241
}
237
- else children foreach { toXML(_, pscope, sb) }
242
+ else children foreach { toXML(_, pscope, sb, stripComments, decodeEntities, preserveWhitespace, minimizeTags ) }
238
243
}
239
244
240
245
/**
0 commit comments