diff options
-rw-r--r-- | sources/scala/xml/Document.scala | 26 | ||||
-rw-r--r-- | sources/scala/xml/NodeTraverser.scala | 15 | ||||
-rw-r--r-- | sources/scala/xml/PrefixedAttribute.scala | 30 | ||||
-rw-r--r-- | sources/scala/xml/TypeSymbol.scala | 10 | ||||
-rw-r--r-- | sources/scala/xml/UnprefixedAttribute.scala | 10 |
5 files changed, 75 insertions, 16 deletions
diff --git a/sources/scala/xml/Document.scala b/sources/scala/xml/Document.scala index cf34721a43..38503eb834 100644 --- a/sources/scala/xml/Document.scala +++ b/sources/scala/xml/Document.scala @@ -1,19 +1,29 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2003-2005, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + package scala.xml; -/** a document information item (according to InfoSet spec). The comments +/** A document information item (according to InfoSet spec). The comments * are copied from the Infoset spec, only augmented with some information * on the Scala types for definitions that might have no value. */ class Document extends NodeSeq { /** An ordered list of child information items, in document - * order. The list contains exactly one element information item. The - * list also contains one processing instruction information item for - * each processing instruction outside the document element, and one - * comment information item for each comment outside the document - * element. Processing instructions and comments within the DTD are - * excluded. If there is a document type declaration, the list also - * contains a document type declaration information item. + * order. The list contains exactly one element information item. The + * list also contains one processing instruction information item for + * each processing instruction outside the document element, and one + * comment information item for each comment outside the document + * element. Processing instructions and comments within the DTD are + * excluded. If there is a document type declaration, the list also + * contains a document type declaration information item. */ var children: Seq[Node] = _; diff --git a/sources/scala/xml/NodeTraverser.scala b/sources/scala/xml/NodeTraverser.scala index e46adff393..690c85534d 100644 --- a/sources/scala/xml/NodeTraverser.scala +++ b/sources/scala/xml/NodeTraverser.scala @@ -1,19 +1,30 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2003-2005, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + package scala.xml; import parsing.MarkupHandler; trait NodeTraverser extends MarkupHandler { - def traverse(n:Node): Unit = n match { + def traverse(n: Node): Unit = n match { case x:ProcInstr => procInstr(0, x.target, x.text) case x:Comment => comment(0, x.text) case x:Text => text(0, x.data) case x:EntityRef => entityRef(0, x.entityName) case _ => elemStart(0, n.prefix, n.label, n.attributes, n.scope); - for(val m <- n.child) + for (val m <- n.child) traverse(m); elem(0, n.prefix, n.label, n.attributes, n.scope, NodeSeq.fromSeq(n.child)); elemEnd(0, n.prefix, n.label); } + } diff --git a/sources/scala/xml/PrefixedAttribute.scala b/sources/scala/xml/PrefixedAttribute.scala index 7be7ffe338..9ceecc45ff 100644 --- a/sources/scala/xml/PrefixedAttribute.scala +++ b/sources/scala/xml/PrefixedAttribute.scala @@ -1,10 +1,25 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2003-2005, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + package scala.xml; /** prefixed attributes always have a non-null namespace */ -class PrefixedAttribute(val pre: String, val key: String, val value: String, val next: MetaData) extends MetaData { +class PrefixedAttribute(val pre: String, + val key: String, + val value: String, + val next: MetaData) extends MetaData { - /** returns a copy of this unprefixed attribute with the given next field*/ + /** Returns a copy of this unprefixed attribute with the given + * next field. + */ def copy(next: MetaData) = new PrefixedAttribute(pre, key, value, next); @@ -13,16 +28,19 @@ class PrefixedAttribute(val pre: String, val key: String, val value: String, val //** duplicates the MetaData (deep copy), prepending it to tail */ /* - def deepCopy(tail:MetaData): MetaData = { + def deepCopy(tail: MetaData): MetaData = { val md = copy(tail); - if(null == next) + if (null == next) md else next.deepCopy(md) } */ - def equals1(m:MetaData) = m.isPrefixed && (m.asInstanceOf[PrefixedAttribute].pre == pre) && (m.key == key) && (m.value == value); + def equals1(m: MetaData) = + m.isPrefixed && + (m.asInstanceOf[PrefixedAttribute].pre == pre) && + (m.key == key) && (m.value == value); def getNamespace(owner: Node) = owner.getNamespace(pre); @@ -33,7 +51,7 @@ class PrefixedAttribute(val pre: String, val key: String, val value: String, val /** gets attribute value of qualified (prefixed) attribute with given key */ def getValue(namespace: String, scope: NamespaceBinding, key: String): String = { - if(key == this.key && scope.getURI(pre) == namespace) + if (key == this.key && scope.getURI(pre) == namespace) value else next.getValue(namespace, scope, key); diff --git a/sources/scala/xml/TypeSymbol.scala b/sources/scala/xml/TypeSymbol.scala index 57b46dc98f..1d5fba7ae6 100644 --- a/sources/scala/xml/TypeSymbol.scala +++ b/sources/scala/xml/TypeSymbol.scala @@ -1 +1,11 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2005, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $id: $ + package scala.xml; trait TypeSymbol {} diff --git a/sources/scala/xml/UnprefixedAttribute.scala b/sources/scala/xml/UnprefixedAttribute.scala index 90081909a6..9e006529ae 100644 --- a/sources/scala/xml/UnprefixedAttribute.scala +++ b/sources/scala/xml/UnprefixedAttribute.scala @@ -1,3 +1,13 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2005, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $id: $ + package scala.xml; /** unprefixed attributes have the null namespace |