scala xml rewrite rule (or, simple pattern help)
- by williamstw
I'm missing some fairly simple syntax I gather. I'm trying to rewrite an element label to something else and keep everything else intact.
object htmlRule extends RewriteRule {
override def transform(n: Node): Seq[Node] = n match {
case Elem(prefix, "document", attribs, scope, child@_*) =>
Elem(prefix, "html", attribs, scope, child)
case other => other
}
}
Now, I ask for an explanation of two things:
1) What exactly does "child@_*" mean in plain English?
2) How can I capture the value of "child@_*" and just let it pass right through to the new element? Currently, I get the following error, which makes sense.
[error] found : Seq[scala.xml.Node]
[error] required: scala.xml.Node
[error] Elem(prefix, "html", attribs, scope, child)
I'm not wedded to this either, so if there's a better way to simply change the element name of a specific node, let's here it...
Thanks,
--tim