package scala.xml
class PrefixedAttribute(
val pre: String,
val key: String,
val value: Seq[Node],
val next: MetaData)
extends Attribute
{
if (value eq null)
throw new UnsupportedOperationException("value is null")
def this(pre: String, key: String, value: String, next: MetaData) =
this(pre, key, Text(value), next)
def copy(next: MetaData) =
new PrefixedAttribute(pre, key, value, next)
def getNamespace(owner: Node) =
owner.getNamespace(pre)
def apply(key: String): Seq[Node] = next(key)
def apply(namespace: String, scope: NamespaceBinding, key: String): Seq[Node] = {
if (key == this.key && scope.getURI(pre) == namespace)
value
else
next(namespace, scope, key)
}
}
object PrefixedAttribute {
def unapply(x: PrefixedAttribute) = Some(x.pre, x.key, x.value, x.next)
}