Aladdin - Scala Bugtracking
[#964] project: api priority: low category: feature
submitter assigned to status date submitted
Nikolay Burak noise 2007-02-23 15:27:00.0
subject [contrib #350] constructors for scala.xml.Node
code
def copyNode(M : Node) : Node = {
	Elem(M.prefix, M.label, M.attributes, M.scope, M.child)
}
what happened
omdoc-xml.scala:44: error: type mismatch;
 found   : scala.Seq[scala.xml.Node]
 required: scala.xml.Node
                Elem(M.prefix, M.label, M.attributes, M.scope, M.child)
                                                                ^
one error found
what expected There seems to be no way to construct a Node except with a constant number of children passed separately to the constructor, i.e., Elem(M.prefix, M.label, M.attributes, M.scope, M.child(0), ..., M.child(n)). I guess it's possible with lteral XML, but something like the above example would be awkward. This is in contrast to the example on http://lamp.epfl.ch/~emir/projects/scalaxbook/scalaxbook.docbk.html#id2508510 which says that a def add( p: Node, e: Node ) = Elem(null, p.label, Null, TopScope, p.child concat e) is possible.
[back to overview]
Changes of this bug report
Nikolay  edited on  2007-02-23 15:27:50.0
contribution #350
Burak  edited on  2007-02-27 10:42:32.0
needs to use child:_*