File tree 2 files changed +23
-2
lines changed
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) {
203
203
* @param sb the stringbuffer to append to
204
204
*/
205
205
def format (n : Node , sb : StringBuilder ) { // entry point
206
- format(n, null , sb)
206
+ format(n, TopScope , sb)
207
207
}
208
208
209
209
def format (n : Node , pscope : NamespaceBinding , sb : StringBuilder ) { // entry point
@@ -253,7 +253,7 @@ class PrettyPrinter(width: Int, step: Int) {
253
253
* @param nodes the sequence of nodes to be serialized
254
254
* @param pscope the namespace to prefix mapping
255
255
*/
256
- def formatNodes (nodes : Seq [Node ], pscope : NamespaceBinding = null ): String =
256
+ def formatNodes (nodes : Seq [Node ], pscope : NamespaceBinding = TopScope ): String =
257
257
sbToString(formatNodes(nodes, pscope, _))
258
258
259
259
/**
Original file line number Diff line number Diff line change @@ -836,4 +836,25 @@ expected closing tag of foo
836
836
assertEquals(""" <x:foo xmlns:x="gaga"/>""" , pp.format(x))
837
837
}
838
838
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
+ }
839
860
}
You can’t perform that action at this time.
0 commit comments