diff options
author | Paul Phillips <paulp@improving.org> | 2009-05-01 20:40:19 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-05-01 20:40:19 +0000 |
commit | 6befaa0f9dbfebcfc16a1ab02d666124fb776ede (patch) | |
tree | 7b27a161f70546f581c7fbd6fe7ce1f39938f3c2 /src/library | |
parent | 8cc51cc0dce7d86a4137eb636c4e3bed1b90cf13 (diff) | |
download | scala-6befaa0f9dbfebcfc16a1ab02d666124fb776ede.tar.gz scala-6befaa0f9dbfebcfc16a1ab02d666124fb776ede.tar.bz2 scala-6befaa0f9dbfebcfc16a1ab02d666124fb776ede.zip |
Renamed overloaded toString variations througho...
Renamed overloaded toString variations throughout scala.xml to
buildString. Fixes bug #547, includes test case.
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/xml/Atom.scala | 2 | ||||
-rw-r--r-- | src/library/scala/xml/Comment.scala | 2 | ||||
-rw-r--r-- | src/library/scala/xml/EntityRef.scala | 4 | ||||
-rw-r--r-- | src/library/scala/xml/Group.scala | 2 | ||||
-rw-r--r-- | src/library/scala/xml/MetaData.scala | 6 | ||||
-rw-r--r-- | src/library/scala/xml/NamespaceBinding.scala | 10 | ||||
-rw-r--r-- | src/library/scala/xml/Node.scala | 4 | ||||
-rw-r--r-- | src/library/scala/xml/Null.scala | 2 | ||||
-rw-r--r-- | src/library/scala/xml/PCData.scala | 2 | ||||
-rw-r--r-- | src/library/scala/xml/PrettyPrinter.scala | 6 | ||||
-rw-r--r-- | src/library/scala/xml/ProcInstr.scala | 2 | ||||
-rw-r--r-- | src/library/scala/xml/SpecialNode.scala | 2 | ||||
-rw-r--r-- | src/library/scala/xml/Text.scala | 2 | ||||
-rw-r--r-- | src/library/scala/xml/TopScope.scala | 21 | ||||
-rw-r--r-- | src/library/scala/xml/Unparsed.scala | 2 | ||||
-rw-r--r-- | src/library/scala/xml/Utility.scala | 8 | ||||
-rw-r--r-- | src/library/scala/xml/Xhtml.scala | 10 | ||||
-rw-r--r-- | src/library/scala/xml/dtd/ContentModel.scala | 40 | ||||
-rw-r--r-- | src/library/scala/xml/dtd/Decl.scala | 50 | ||||
-rw-r--r-- | src/library/scala/xml/dtd/ExternalID.scala | 2 |
20 files changed, 86 insertions, 93 deletions
diff --git a/src/library/scala/xml/Atom.scala b/src/library/scala/xml/Atom.scala index f655ac3136..aeb2dedeb3 100644 --- a/src/library/scala/xml/Atom.scala +++ b/src/library/scala/xml/Atom.scala @@ -45,7 +45,7 @@ class Atom[+A](val data: A) extends SpecialNode { * @param sb ... * @return ... */ - def toString(sb: StringBuilder) = + def buildString(sb: StringBuilder) = Utility.escape(data.toString(), sb) override def text: String = data.toString() diff --git a/src/library/scala/xml/Comment.scala b/src/library/scala/xml/Comment.scala index 19e4315dbe..582b12d032 100644 --- a/src/library/scala/xml/Comment.scala +++ b/src/library/scala/xml/Comment.scala @@ -39,6 +39,6 @@ case class Comment(commentText: String) extends SpecialNode { /** Appends "<!-- text -->" to this string buffer. */ - override def toString(sb: StringBuilder) = + override def buildString(sb: StringBuilder) = sb.append("<!--").append(commentText).append("-->") } diff --git a/src/library/scala/xml/EntityRef.scala b/src/library/scala/xml/EntityRef.scala index 26963fb224..9ce63d81f9 100644 --- a/src/library/scala/xml/EntityRef.scala +++ b/src/library/scala/xml/EntityRef.scala @@ -42,7 +42,7 @@ case class EntityRef(entityName: String) extends SpecialNode { case "amp" => "&" case "apos" => "'" case "quot" => "\"" - case _ => val sb = new StringBuilder(); toString(sb).toString() + case _ => val sb = new StringBuilder(); buildString(sb).toString() } /** Appends "& entityName;" to this string buffer. @@ -50,7 +50,7 @@ case class EntityRef(entityName: String) extends SpecialNode { * @param sb the string buffer. * @return the modified string buffer <code>sb</code>. */ - override def toString(sb: StringBuilder) = + override def buildString(sb: StringBuilder) = sb.append("&").append(entityName).append(";") } diff --git a/src/library/scala/xml/Group.scala b/src/library/scala/xml/Group.scala index a304e4610b..4831514fd4 100644 --- a/src/library/scala/xml/Group.scala +++ b/src/library/scala/xml/Group.scala @@ -57,7 +57,7 @@ case class Group(val nodes: Seq[Node]) extends Node { /** * @throws Predef.UnsupportedOperationException (always) */ - def toString(sb: StringBuilder) = + def buildString(sb: StringBuilder) = throw new UnsupportedOperationException( "class Group does not support method toString(StringBuilder)") diff --git a/src/library/scala/xml/MetaData.scala b/src/library/scala/xml/MetaData.scala index e2537b6018..71d6befc20 100644 --- a/src/library/scala/xml/MetaData.scala +++ b/src/library/scala/xml/MetaData.scala @@ -245,14 +245,14 @@ abstract class MetaData extends Collection[MetaData] { override def toString(): String = { val sb = new StringBuilder() - toString(sb) + buildString(sb) sb.toString() } - def toString(sb: StringBuilder): StringBuilder = { + def buildString(sb: StringBuilder): StringBuilder = { sb.append(' ') toString1(sb) - next.toString(sb) + next.buildString(sb) } /** diff --git a/src/library/scala/xml/NamespaceBinding.scala b/src/library/scala/xml/NamespaceBinding.scala index 4922e3915b..7605fbacd2 100644 --- a/src/library/scala/xml/NamespaceBinding.scala +++ b/src/library/scala/xml/NamespaceBinding.scala @@ -44,17 +44,17 @@ class NamespaceBinding(val prefix: String, override def toString(): String = { val sb = new StringBuilder() - toString(sb, TopScope) + buildString(sb, TopScope) sb.toString() } - def toString(stop: NamespaceBinding): String = { + def buildString(stop: NamespaceBinding): String = { val sb = new StringBuilder() - toString(sb, stop) + buildString(sb, stop) sb.toString() } - def toString(sb: StringBuilder, stop: NamespaceBinding): Unit = { + def buildString(sb: StringBuilder, stop: NamespaceBinding): Unit = { if (this ne stop) { // contains? sb.append(" xmlns") if (prefix ne null) { @@ -64,7 +64,7 @@ class NamespaceBinding(val prefix: String, .append('"') .append(if (uri == null) "" else uri) .append('"'); - parent.toString(sb, stop) // copy(ignore) + parent.buildString(sb, stop) // copy(ignore) } } diff --git a/src/library/scala/xml/Node.scala b/src/library/scala/xml/Node.scala index 942220dc9e..c5909130eb 100644 --- a/src/library/scala/xml/Node.scala +++ b/src/library/scala/xml/Node.scala @@ -170,7 +170,7 @@ abstract class Node extends NodeSeq { * @param stripComment if true, strips comment nodes from result * @return ... */ - def toString(stripComment: Boolean): String = + def buildString(stripComment: Boolean): String = Utility.toXML(this, stripComment) /** @@ -178,7 +178,7 @@ abstract class Node extends NodeSeq { * * @see <code><a href="#toString">toString(Boolean)</a></code> */ - override def toString(): String = toString(false) + override def toString(): String = buildString(false) /** * Appends qualified name of this node to <code>StringBuilder</code>. diff --git a/src/library/scala/xml/Null.scala b/src/library/scala/xml/Null.scala index 0fa06df72c..b269672b8c 100644 --- a/src/library/scala/xml/Null.scala +++ b/src/library/scala/xml/Null.scala @@ -71,7 +71,7 @@ case object Null extends MetaData { override def toString(): String = "" - override def toString(sb: StringBuilder): StringBuilder = sb + override def buildString(sb: StringBuilder): StringBuilder = sb override def wellformed(scope: NamespaceBinding) = true diff --git a/src/library/scala/xml/PCData.scala b/src/library/scala/xml/PCData.scala index 545fcdc028..210b82f54b 100644 --- a/src/library/scala/xml/PCData.scala +++ b/src/library/scala/xml/PCData.scala @@ -23,7 +23,7 @@ case class PCData(_data: String) extends Atom[String](_data) { * @param sb ... * @return ... */ - override def toString(sb: StringBuilder) = { + override def buildString(sb: StringBuilder) = { sb.append("<![CDATA[") sb.append(data) sb.append("]]>") diff --git a/src/library/scala/xml/PrettyPrinter.scala b/src/library/scala/xml/PrettyPrinter.scala index 2415635132..7e09d58c9b 100644 --- a/src/library/scala/xml/PrettyPrinter.scala +++ b/src/library/scala/xml/PrettyPrinter.scala @@ -116,7 +116,7 @@ class PrettyPrinter( width:Int, step:Int ) { val sb = new StringBuilder("<") n.nameToString(sb) //Utility.appendPrefixedName( n.prefix, n.label, pmap, sb ); - n.attributes.toString(sb) + n.attributes.buildString(sb) //Utility.attr2xml( n.scope, n.attributes, pmap, sb ); sb.append("/>") sb.toString() @@ -126,8 +126,8 @@ class PrettyPrinter( width:Int, step:Int ) { val sb = new StringBuilder("<") n.nameToString(sb) //Utility.appendPrefixedName( n.prefix, n.label, pmap, sb ); val i = sb.length + 1 - n.attributes.toString(sb) - n.scope.toString(sb, pscope) + n.attributes.buildString(sb) + n.scope.buildString(sb, pscope) sb.append('>') (sb.toString(), i) } diff --git a/src/library/scala/xml/ProcInstr.scala b/src/library/scala/xml/ProcInstr.scala index 08e86acff8..6268ab4adc 100644 --- a/src/library/scala/xml/ProcInstr.scala +++ b/src/library/scala/xml/ProcInstr.scala @@ -50,7 +50,7 @@ case class ProcInstr(target:String, proctext:String) extends SpecialNode { /** appends "<?" target (" "+text)?+"?>" * to this stringbuffer. */ - override def toString(sb: StringBuilder) = { + override def buildString(sb: StringBuilder) = { sb .append("<?") .append(target); diff --git a/src/library/scala/xml/SpecialNode.scala b/src/library/scala/xml/SpecialNode.scala index 7517161426..9663258abc 100644 --- a/src/library/scala/xml/SpecialNode.scala +++ b/src/library/scala/xml/SpecialNode.scala @@ -33,6 +33,6 @@ abstract class SpecialNode extends Node with pull.XMLEvent { final def child = Nil /** append string representation to the given stringbuffer */ - def toString(sb: StringBuilder): StringBuilder + def buildString(sb: StringBuilder): StringBuilder } diff --git a/src/library/scala/xml/Text.scala b/src/library/scala/xml/Text.scala index fcfe3499ab..7b01439fa3 100644 --- a/src/library/scala/xml/Text.scala +++ b/src/library/scala/xml/Text.scala @@ -37,7 +37,7 @@ case class Text(_data: String) extends Atom[String](_data) { * @param sb ... * @return ... */ - override def toString(sb: StringBuilder) = + override def buildString(sb: StringBuilder) = Utility.escape(data, sb) } diff --git a/src/library/scala/xml/TopScope.scala b/src/library/scala/xml/TopScope.scala index becf0b8854..983d0f99ef 100644 --- a/src/library/scala/xml/TopScope.scala +++ b/src/library/scala/xml/TopScope.scala @@ -16,24 +16,17 @@ import Predef._ * for the "xml" prefix which is bound to * "http://www.w3.org/XML/1998/namespace" */ -case object TopScope extends NamespaceBinding(null, null, null) { +case object TopScope extends NamespaceBinding(null, null, null) +{ + import XML.{ xml, namespace } override def getURI(prefix1: String): String = - if(prefix1 == "xml" /*XML.xml*/) - "http://www.w3.org/XML/1998/namespace" - else - null + if (prefix1 == xml) namespace else null override def getPrefix(uri1: String): String = - if (uri1 == "http://www.w3.org/XML/1998/namespace" /*XML.namespace*/) - "xml" //XML.xml - else - null + if (uri1 == namespace) xml else null override def toString() = "" - - override def toString(stop: NamespaceBinding) = "" - - override def toString(sb: StringBuilder, ignore: NamespaceBinding) = {} - + override def buildString(stop: NamespaceBinding) = "" + override def buildString(sb: StringBuilder, ignore: NamespaceBinding) = {} } diff --git a/src/library/scala/xml/Unparsed.scala b/src/library/scala/xml/Unparsed.scala index 31191ba36f..3563d47a91 100644 --- a/src/library/scala/xml/Unparsed.scala +++ b/src/library/scala/xml/Unparsed.scala @@ -31,6 +31,6 @@ case class Unparsed(_data: String) extends Atom[String](_data) { } /** returns text, with some characters escaped according to XML spec */ - override def toString(sb: StringBuilder) = sb append data + override def buildString(sb: StringBuilder) = sb append data } diff --git a/src/library/scala/xml/Utility.scala b/src/library/scala/xml/Utility.scala index d2c6be5bac..4d8f99fa9e 100644 --- a/src/library/scala/xml/Utility.scala +++ b/src/library/scala/xml/Utility.scala @@ -187,10 +187,10 @@ object Utility extends AnyRef with parsing.TokenTests { x match { case c: Comment if !stripComment => - c.toString(sb) + c.buildString(sb) case x: SpecialNode => - x.toString(sb) + x.buildString(sb) case g: Group => for (c <- g.nodes) toXML(c, x.scope, sb, stripComment) @@ -199,8 +199,8 @@ object Utility extends AnyRef with parsing.TokenTests { // print tag with namespace declarations sb.append('<') x.nameToString(sb) - if (x.attributes ne null) x.attributes.toString(sb) - x.scope.toString(sb, pscope) + if (x.attributes ne null) x.attributes.buildString(sb) + x.scope.buildString(sb, pscope) if (x.child.isEmpty) // no children, so use short form: <xyz .../> sb.append("/>") diff --git a/src/library/scala/xml/Xhtml.scala b/src/library/scala/xml/Xhtml.scala index 6d49d091d3..2d0b33b6ad 100644 --- a/src/library/scala/xml/Xhtml.scala +++ b/src/library/scala/xml/Xhtml.scala @@ -57,24 +57,24 @@ object Xhtml { def decode(er: EntityRef) = XhtmlEntities.entMap.get(er.entityName) match { case Some(chr) if chr.toInt >= 128 => sb.append(chr) - case _ => er.toString(sb) + case _ => er.buildString(sb) } def shortForm = (x.child == null || x.child.length == 0) && !(List("div", "script", "textarea") contains x.label) x match { - case c: Comment if !stripComment => c.toString(sb) + case c: Comment if !stripComment => c.buildString(sb) case er: EntityRef if convertAmp => decode(er) - case x: SpecialNode => x.toString(sb) + case x: SpecialNode => x.buildString(sb) case g: Group => g.nodes foreach { toXhtml(_, x.scope, sb, stripComment, convertAmp) } case _ => sb.append('<') x.nameToString(sb) - if (x.attributes ne null) x.attributes.toString(sb) - x.scope.toString(sb, pscope) + if (x.attributes ne null) x.attributes.buildString(sb) + x.scope.buildString(sb, pscope) if (shortForm) sb.append(" />") else { diff --git a/src/library/scala/xml/dtd/ContentModel.scala b/src/library/scala/xml/dtd/ContentModel.scala index 498a121f53..013f3d0414 100644 --- a/src/library/scala/xml/dtd/ContentModel.scala +++ b/src/library/scala/xml/dtd/ContentModel.scala @@ -49,25 +49,25 @@ object ContentModel extends WordExp { return s } - def toString(r: RegExp): String = { + def buildString(r: RegExp): String = { val sb = new StringBuilder() - toString(r, sb) + buildString(r, sb) sb.toString() } /* precond: rs.length >= 1 */ - private def toString(rs: Seq[RegExp], sb: StringBuilder, sep: Char) { + private def buildString(rs: Seq[RegExp], sb: StringBuilder, sep: Char) { val it = rs.elements val fst = it.next - toString(fst, sb) + buildString(fst, sb) for (z <- it) { sb.append(sep) - toString(z, sb) + buildString(z, sb) } sb } - def toString(c: ContentModel, sb: StringBuilder): StringBuilder = c match { + def buildString(c: ContentModel, sb: StringBuilder): StringBuilder = c match { case ANY => sb.append("ANY") case EMPTY => @@ -75,18 +75,18 @@ object ContentModel extends WordExp { case PCDATA => sb.append("(#PCDATA)") case ELEMENTS( _ ) | MIXED( _ ) => - c.toString(sb) + c.buildString(sb) } - def toString(r: RegExp, sb:StringBuilder): StringBuilder = r match { // !!! check for match translation problem + def buildString(r: RegExp, sb:StringBuilder): StringBuilder = r match { // !!! check for match translation problem case Eps => sb case Sequ(rs @ _*) => - sb.append( '(' ); toString(rs, sb, ','); sb.append( ')' ) + sb.append( '(' ); buildString(rs, sb, ','); sb.append( ')' ) case Alt(rs @ _*) => - sb.append( '(' ); toString(rs, sb, '|'); sb.append( ')' ) + sb.append( '(' ); buildString(rs, sb, '|'); sb.append( ')' ) case Star(r: RegExp) => - sb.append( '(' ); toString(r, sb); sb.append( ")*" ) + sb.append( '(' ); buildString(r, sb); sb.append( ")*" ) case Letter(ElemName(name)) => sb.append(name) } @@ -97,11 +97,11 @@ sealed abstract class ContentModel { override def toString(): String = { val sb = new StringBuilder() - toString(sb) + buildString(sb) sb.toString() } - def toString(sb:StringBuilder): StringBuilder; + def buildString(sb:StringBuilder): StringBuilder; /* def validate(cs: NodeSeq): Boolean = this.match { case ANY => true @@ -115,13 +115,13 @@ sealed abstract class ContentModel { } case object PCDATA extends ContentModel { - override def toString(sb: StringBuilder): StringBuilder = sb.append("(#PCDATA)") + override def buildString(sb: StringBuilder): StringBuilder = sb.append("(#PCDATA)") } case object EMPTY extends ContentModel { - override def toString(sb: StringBuilder): StringBuilder = sb.append("EMPTY") + override def buildString(sb: StringBuilder): StringBuilder = sb.append("EMPTY") } case object ANY extends ContentModel { - override def toString(sb: StringBuilder): StringBuilder = sb.append("ANY") + override def buildString(sb: StringBuilder): StringBuilder = sb.append("ANY") } sealed abstract class DFAContentModel extends ContentModel { import ContentModel.ElemName @@ -159,9 +159,9 @@ Console.println("ns = "+ns); } } */ - override def toString(sb: StringBuilder): StringBuilder = { + override def buildString(sb: StringBuilder): StringBuilder = { sb.append("(#PCDATA|") - ContentModel.toString(Alt(r.asInstanceOf[Alt].rs.toList.drop(1):_*):RegExp, sb); + ContentModel.buildString(Alt(r.asInstanceOf[Alt].rs.toList.drop(1):_*):RegExp, sb); sb.append(")*"); } } @@ -185,6 +185,6 @@ case class ELEMENTS(r:ContentModel.RegExp) extends DFAContentModel { } } */ - override def toString(sb: StringBuilder): StringBuilder = - ContentModel.toString(r, sb) + override def buildString(sb: StringBuilder): StringBuilder = + ContentModel.buildString(r, sb) } diff --git a/src/library/scala/xml/dtd/Decl.scala b/src/library/scala/xml/dtd/Decl.scala index fbde14fd1d..b94c56062b 100644 --- a/src/library/scala/xml/dtd/Decl.scala +++ b/src/library/scala/xml/dtd/Decl.scala @@ -15,27 +15,27 @@ package scala.xml.dtd abstract class Decl abstract class MarkupDecl extends Decl { - def toString(sb: StringBuilder): StringBuilder + def buildString(sb: StringBuilder): StringBuilder } /** an element declaration */ case class ElemDecl(name: String, contentModel: ContentModel) extends MarkupDecl with DtdTypeSymbol { - override def toString(sb: StringBuilder): StringBuilder = { + override def buildString(sb: StringBuilder): StringBuilder = { sb .append("<!ELEMENT ") .append(name) .append(' '); - ContentModel.toString(contentModel, sb); + ContentModel.buildString(contentModel, sb); sb.append('>'); } } case class AttListDecl(name: String, attrs:List[AttrDecl]) extends MarkupDecl with DtdTypeSymbol { - override def toString(sb: StringBuilder): StringBuilder = { + override def buildString(sb: StringBuilder): StringBuilder = { sb .append("<!ATTLIST ") .append(name) @@ -50,11 +50,11 @@ extends MarkupDecl with DtdTypeSymbol { */ case class AttrDecl(name: String, tpe: String, default: DefaultDecl) { override def toString(): String = - toString(new StringBuilder()).toString(); + buildString(new StringBuilder()).toString(); - def toString(sb: StringBuilder): StringBuilder = { + def buildString(sb: StringBuilder): StringBuilder = { sb.append(" ").append(name).append(' ').append(tpe).append(' '); - default.toString(sb) + default.buildString(sb) } } @@ -64,37 +64,37 @@ abstract class EntityDecl extends MarkupDecl /** a parsed general entity declaration */ case class ParsedEntityDecl(name: String, entdef: EntityDef) extends EntityDecl { - override def toString(sb: StringBuilder): StringBuilder = { + override def buildString(sb: StringBuilder): StringBuilder = { sb.append("<!ENTITY ").append( name ).append(' '); - entdef.toString(sb).append('>') + entdef.buildString(sb).append('>') } } /** a parameter entity declaration */ case class ParameterEntityDecl(name: String, entdef: EntityDef) extends EntityDecl { - override def toString(sb: StringBuilder): StringBuilder = { + override def buildString(sb: StringBuilder): StringBuilder = { sb.append("<!ENTITY % ").append( name ).append(' '); - entdef.toString(sb).append('>') + entdef.buildString(sb).append('>') } } /** an unparsed entity declaration */ case class UnparsedEntityDecl( name:String, extID:ExternalID, notation:String ) extends EntityDecl { - override def toString(sb: StringBuilder): StringBuilder = { + override def buildString(sb: StringBuilder): StringBuilder = { sb.append("<!ENTITY ").append( name ).append(' '); - extID.toString(sb).append(" NDATA ").append(notation).append('>'); + extID.buildString(sb).append(" NDATA ").append(notation).append('>'); } } /** a notation declaration */ case class NotationDecl( name:String, extID:ExternalID ) extends MarkupDecl { - override def toString(sb: StringBuilder): StringBuilder = { + override def buildString(sb: StringBuilder): StringBuilder = { sb.append("<!NOTATION ").append( name ).append(' '); - extID.toString(sb) + extID.buildString(sb) } } abstract class EntityDef { - def toString(sb: StringBuilder): StringBuilder + def buildString(sb: StringBuilder): StringBuilder } case class IntDef(value:String) extends EntityDef { @@ -118,14 +118,14 @@ case class IntDef(value:String) extends EntityDef { } validateValue(); - override def toString(sb: StringBuilder): StringBuilder = + override def buildString(sb: StringBuilder): StringBuilder = Utility.appendQuoted(value, sb); } case class ExtDef(extID:ExternalID) extends EntityDef { - override def toString(sb: StringBuilder): StringBuilder = - extID.toString(sb); + override def buildString(sb: StringBuilder): StringBuilder = + extID.buildString(sb); } @@ -134,7 +134,7 @@ case class PEReference(ent:String) extends MarkupDecl { if( !Utility.isName( ent )) throw new IllegalArgumentException("ent must be an XML Name"); - override def toString(sb: StringBuilder): StringBuilder = + override def buildString(sb: StringBuilder): StringBuilder = sb.append('%').append(ent).append(';'); } @@ -143,24 +143,24 @@ case class PEReference(ent:String) extends MarkupDecl { abstract class DefaultDecl { override def toString(): String - def toString(sb: StringBuilder): StringBuilder + def buildString(sb: StringBuilder): StringBuilder } case object REQUIRED extends DefaultDecl { override def toString(): String = "#REQUIRED" - override def toString(sb: StringBuilder) = sb.append("#REQUIRED") + override def buildString(sb: StringBuilder) = sb.append("#REQUIRED") } case object IMPLIED extends DefaultDecl { override def toString(): String = "#IMPLIED" - override def toString(sb: StringBuilder) = sb.append("#IMPLIED") + override def buildString(sb: StringBuilder) = sb.append("#IMPLIED") } case class DEFAULT(fixed: Boolean, attValue: String) extends DefaultDecl { override def toString(): String = - toString(new StringBuilder()).toString(); + buildString(new StringBuilder()).toString(); - override def toString(sb: StringBuilder): StringBuilder = { + override def buildString(sb: StringBuilder): StringBuilder = { if (fixed) sb.append("#FIXED ") Utility.appendEscapedQuoted(attValue, sb) } diff --git a/src/library/scala/xml/dtd/ExternalID.scala b/src/library/scala/xml/dtd/ExternalID.scala index 75c4f39058..c59a5032c8 100644 --- a/src/library/scala/xml/dtd/ExternalID.scala +++ b/src/library/scala/xml/dtd/ExternalID.scala @@ -32,7 +32,7 @@ abstract class ExternalID extends parsing.TokenTests else "PUBLIC " + quotedPublicLiteral + (if (systemId == null) "" else " " + quotedSystemLiteral) } - def toString(sb: StringBuilder): StringBuilder = + def buildString(sb: StringBuilder): StringBuilder = sb.append(this.toString()) def systemId: String |