From 427e592c27ff9ce7c079903789b66ae165dbd8a2 Mon Sep 17 00:00:00 2001 From: buraq Date: Tue, 26 Apr 2005 11:06:01 +0000 Subject: hello --- config/list/library.lst | 5 ++ sources/scala/xml/MetaData.scala | 161 --------------------------------------- 2 files changed, 5 insertions(+), 161 deletions(-) diff --git a/config/list/library.lst b/config/list/library.lst index a884ec94b2..2c7f810d67 100644 --- a/config/list/library.lst +++ b/config/list/library.lst @@ -215,6 +215,7 @@ util/logging/Logged.scala util/logging/ConsoleLogger.scala xml/Comment.scala +#xml/Document.scala xml/Elem.scala xml/EntityRef.scala xml/MetaData.scala @@ -222,19 +223,23 @@ xml/NamespaceBinding.scala xml/Node.scala xml/NodeBuffer.scala xml/NodeSeq.scala +xml/Null.scala #xml/NodeTraverser.scala xml/Parsing.scala xml/PrettyPrinter.scala +xml/PrefixedAttribute.scala xml/ProcInstr.scala xml/SpecialNode.scala xml/Text.scala xml/TextBuffer.scala xml/TopScope.scala +xml/UnprefixedAttribute.scala xml/Utility.scala xml/XML.scala xml/dtd/ContentModel.scala xml/dtd/DocType.scala +#xml/dtd/DTD.scala xml/dtd/Decl.scala xml/dtd/ExternalID.scala xml/dtd/Parser.scala diff --git a/sources/scala/xml/MetaData.scala b/sources/scala/xml/MetaData.scala index 9ed7e4363b..d6c0620e37 100644 --- a/sources/scala/xml/MetaData.scala +++ b/sources/scala/xml/MetaData.scala @@ -107,164 +107,3 @@ abstract class MetaData extends Iterable[MetaData] with java.io.Serializable { def wellformed(scope: NamespaceBinding): Boolean; } - -/** prefixed attributes always have a non-null namespace - */ -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*/ - def copy(next: MetaData) = - new PrefixedAttribute(pre, key, value, next); - - //** duplicates the MetaData (deep copy), not preserving order */ - //def deepCopy: MetaData = deepCopy(null); - - //** duplicates the MetaData (deep copy), prepending it to tail */ - /* - def deepCopy(tail:MetaData): MetaData = { - val md = copy(tail); - 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 getNamespace(owner: Node) = - owner.getNamespace(pre); - - /** forwards the call to next */ - def getValue(key: String): String = next.getValue(key); - - /** 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) - value - else - next.getValue(namespace, scope, key); - } - - /** returns true */ - final def isPrefixed = true; - - override def hashCode() = - pre.hashCode() * 41 + key.hashCode() * 7 + value.hashCode() * 3 + next.hashCode(); - - - def toString1(sb:StringBuffer): Unit = { - sb.append(pre); - sb.append(':'); - sb.append(key); - sb.append('='); - Utility.appendQuoted(value, sb); - } - - def wellformed(scope: NamespaceBinding): Boolean = { - (null == next.getValue(scope.getURI(pre), scope, key) - && next.wellformed(scope)); - } - -} - -/** unprefixed attributes have the null namespace - */ -class UnprefixedAttribute(val key: String, val value: String, val next: MetaData) extends MetaData { - - /** returns a copy of this unprefixed attribute with the given next field*/ - def copy(next: MetaData) = - new UnprefixedAttribute(key, value, next); - - def equals1(m:MetaData) = !m.isPrefixed && (m.key == key) && (m.value == value); - - /** returns null */ - final def getNamespace(owner: Node): String = - null; - - /** gets value of unqualified (unprefixed) attribute with given key */ - def getValue(key: String): String = - if(key == this.key) - value - else - next.getValue(key); - - /** forwards the call to next */ - def getValue(namespace: String, scope: NamespaceBinding, key: String): String = - next.getValue(namespace, scope, key); - - override def hashCode() = - key.hashCode() * 7 + value.hashCode() * 53 + next.hashCode(); - - /** returns false */ - final def isPrefixed = false; - - def toString1(sb:StringBuffer): Unit = { - sb.append(key); - sb.append('='); - Utility.appendQuoted(value, sb); - } - - def wellformed(scope: NamespaceBinding): Boolean = - (null == next.getValue(null, scope, key)) && next.wellformed(scope); - -} - -case object Null extends MetaData { - - /** appends given MetaData items to this MetaData list */ - override def append(m: MetaData): MetaData = m; - - override def containedIn1(m:MetaData): Boolean = false; - - /** returns a copy of this MetaData item with next field set to argument */ - def copy(next: MetaData) = next; - - /** returns null */ - def getNamespace(owner: Node) = null; - - final override def hasNext = false; - - final override def length = 0; - - final override def length(i:Int) = i; - - def isPrefixed = false; - - /** deep equals method */ - override def equals(that: Any) = that match { - case m:MetaData => m.length == 0 - case _ => false; - } - - def equals1(that:MetaData) = that.length == 0; - - def key = null; - - def value = null; - - def next = null; - - /** null */ - def getValue(key: String) = null; - - /** gets value of qualified (prefixed) attribute with given key */ - def getValue(namespace: String, scope: NamespaceBinding, key: String) = - null; - - override def hashCode(): Int = 0; - - override def toString1(): String = ""; - - //appends string representations of single attribute to StringBuffer - def toString1(sb:StringBuffer) = {}; - - override def toString(): String = ""; - - override def toString(sb: StringBuffer): Unit = {} - - override def wellformed(scope: NamespaceBinding) = true; - - -} -- cgit v1.2.3