Scala Programming Language
  1. Scala Programming Language
  2. SI-5843

scala.xml.Attribute remove(String, NamespaceBinding, String) method removes all unprefixed attributes unintentionally

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Scala 2.10.0
    • Component/s: XML Support
    • Labels:
      None

      Description

      steps

      1. call remove(String, NamespaceBinding, String) overload on attributes.

      $ scala
      Welcome to Scala version 2.10.0-M3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_31).
      Type in expressions to have them evaluated.
      Type :help for more information.
      
      scala> <test foo="1" bar="2" />.attributes remove (null, scala.xml.TopScope, "foo")
      res0: scala.xml.MetaData = 
      
      scala> <test foo="1" bar="2" />.attributes remove "foo" // this works!
      res1: scala.xml.MetaData =  bar="2"
      

      problem

      remove (null, scala.xml.TopScope, "foo") 
      removes both foo and bar. It in fact removes all unprefixed attributes.

      expectation

      remove (null, scala.xml.TopScope, "foo") 
      removes only foo and returns
      bar="2"
      .

        Activity

        Show
        Lukas Rytz added a comment - https://github.com/scala/scala/pull/638

          People

          • Assignee:
            Lukas Rytz
            Reporter:
            Eugene Yokota
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development