File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -203,7 +203,7 @@ class PrettyPrinter(width: Int, step: Int) {
203203 * @param sb the stringbuffer to append to
204204 */
205205 def format (n : Node , sb : StringBuilder ) { // entry point
206- format(n, null , sb)
206+ format(n, TopScope , sb)
207207 }
208208
209209 def format (n : Node , pscope : NamespaceBinding , sb : StringBuilder ) { // entry point
@@ -253,7 +253,7 @@ class PrettyPrinter(width: Int, step: Int) {
253253 * @param nodes the sequence of nodes to be serialized
254254 * @param pscope the namespace to prefix mapping
255255 */
256- def formatNodes (nodes : Seq [Node ], pscope : NamespaceBinding = null ): String =
256+ def formatNodes (nodes : Seq [Node ], pscope : NamespaceBinding = TopScope ): String =
257257 sbToString(formatNodes(nodes, pscope, _))
258258
259259 /**
Original file line number Diff line number Diff line change @@ -836,4 +836,25 @@ expected closing tag of foo
836836 assertEquals(""" <x:foo xmlns:x="gaga"/>""" , pp.format(x))
837837 }
838838
839+ @ UnitTest
840+ def nodeSeqNs : Unit = {
841+ val x = {
842+ <x : foo xmlns : x =" abc" /><y : bar xmlns : y =" def" />
843+ }
844+ val pp = new PrettyPrinter (80 , 2 )
845+ val expected = """ <x:foo xmlns:x="abc"/><y:bar xmlns:y="def"/>"""
846+ assertEquals(expected, pp.formatNodes(x))
847+ }
848+
849+ @ UnitTest
850+ def nodeStringBuilder : Unit = {
851+ val x = {
852+ <x : foo xmlns : x =" abc" />
853+ }
854+ val pp = new PrettyPrinter (80 , 2 )
855+ val expected = """ <x:foo xmlns:x="abc"/>"""
856+ val sb = new StringBuilder
857+ pp.format(x, sb)
858+ assertEquals(expected, sb.toString)
859+ }
839860}
You can’t perform that action at this time.
0 commit comments