You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
= problem =
When transforming XML, it is often necessary to transform attribute values as well as elements. It would be nice to be able to write something like:
caseelem: Elem=> elem.copy(attributes=for (attr <- elem.attributes) yield attr match {
case attr@Attribute("attrToChange", _, _) => attr.copy(value=Text("newValue"))
case other => other
}
)
= analysis =
This doesn't work in Scala 2.8.1 because xml.Attribute.copy only allows the next attribute to be changed, and because map over an xml.MetaData yields an Iterable[MetaData] not a MetaData.
= enhancement recommendation =
To solve the copying problem, xml.Attribute could grow a method like one of the xml.Attribute.apply methods, e.g.:
Solving the map problem probably means updating Attribute to use the new collections APIs better - e.g. it should probably implement IterableLike[MetaData, MetaData] which I think means it needs a simple Builder that sets the next attributes appropriately.
The text was updated successfully, but these errors were encountered:
= problem =
When transforming XML, it is often necessary to transform attribute values as well as elements. It would be nice to be able to write something like:
= analysis =
This doesn't work in Scala 2.8.1 because
xml.Attribute.copy
only allows thenext
attribute to be changed, and because map over anxml.MetaData
yields anIterable[MetaData]
not aMetaData
.= enhancement recommendation =
To solve the copying problem,
xml.Attribute
could grow a method like one of thexml.Attribute.apply
methods, e.g.:Solving the map problem probably means updating
Attribute
to use the new collections APIs better - e.g. it should probably implementIterableLike[MetaData, MetaData]
which I think means it needs a simpleBuilder
that sets thenext
attributes appropriately.The text was updated successfully, but these errors were encountered: