This page is no longer maintained — Please continue to the home page at www.scala-lang.org

[scala-bts] #2138: NamespaceBinding does not define an "equals" method

1 reply
Scala 2
Joined: 2009-03-05,
User offline. Last seen 42 years 45 weeks ago.

----------------------+-----------------------------------------------------
Reporter: dcsobral | Owner: scala-xml_team
Type: defect | Status: new
Priority: normal | Component: XML support
Keywords: Namespace |
----------------------+-----------------------------------------------------
When generating strings for an XML, each element has its scope -- a
NamespaceBinding object -- compared to that of its parent. If they aren't
equal, a namespace is added to the string representation of that element.

Unfortunately, NamespaceBinding does define an "equals" method, which
means reference equality is used, with unfortunate consequences. Any code
that does not cache Namespaces will end up producing XMLs which repeat the
namespace.

NamespaceBinding is composed of two strings and a NamespaceBinding, so an
equals method can be trivially defined for it.

Scala 2
Joined: 2009-03-05,
User offline. Last seen 42 years 45 weeks ago.
Re: [scala-bts] #2138: NamespaceBinding does not define an "equa

-----------------------------+----------------------------------------------
Reporter: dcsobral | Owner: scala-xml_team
Type: defect | Status: closed
Priority: normal | Component: XML support
Version: Unreleased-2.8.x | Resolution: fixed
Keywords: Namespace |
-----------------------------+----------------------------------------------
Changes (by extempore):

* cc: paulp@… (added)
* status: new => closed
* version: => Unreleased-2.8.x
* resolution: => fixed

Comment:

I made it a case class.

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland