diff options
author | buraq <buraq@epfl.ch> | 2004-07-26 08:26:54 +0000 |
---|---|---|
committer | buraq <buraq@epfl.ch> | 2004-07-26 08:26:54 +0000 |
commit | 4bd55b04d9e905e193eadb7f0c45f4b5d99bb393 (patch) | |
tree | 2a70f42e93b5f4c34e511c7de5adc42e6897c518 | |
parent | 7ddd0a60210de7aef99fcdfbab75693f48b78ac9 (diff) | |
download | scala-4bd55b04d9e905e193eadb7f0c45f4b5d99bb393.tar.gz scala-4bd55b04d9e905e193eadb7f0c45f4b5d99bb393.tar.bz2 scala-4bd55b04d9e905e193eadb7f0c45f4b5d99bb393.zip |
lib
-rw-r--r-- | sources/scala/xml/parsing/MarkupHandler.scala | 10 | ||||
-rw-r--r-- | sources/scala/xml/parsing/MarkupParser.scala | 6 |
2 files changed, 13 insertions, 3 deletions
diff --git a/sources/scala/xml/parsing/MarkupHandler.scala b/sources/scala/xml/parsing/MarkupHandler.scala index 608ae54578..022bf302f3 100644 --- a/sources/scala/xml/parsing/MarkupHandler.scala +++ b/sources/scala/xml/parsing/MarkupHandler.scala @@ -13,7 +13,7 @@ abstract class MarkupHandler[MarkupType, AVType] { /** mapping from prefixes to namespaces */ var namespace: immutable.Map[String,String] = - new immutable.TreeMap[String,String]; + new immutable.TreeMap[String,String].update("",""); /** returns prefix of the qualified name if any */ final def namespacePrefix(name: String): Option[String] = { @@ -51,6 +51,14 @@ abstract class MarkupHandler[MarkupType, AVType] { def attributeCDataValue(pos: int, str:String): AttribValue; def attributeNamespaceDecl(pos: int, uri: String): AttribValue; + final def attribute(pos: int, key: String, value:String): AttribValue = + if( key.startsWith("xmlns")) + attributeNamespaceDecl(pos, value); + else + attributeCDataValue(pos, value); + + + /** be careful to copy everything from attrMap1, as it will change * @param attrMap1 the attribute map. */ diff --git a/sources/scala/xml/parsing/MarkupParser.scala b/sources/scala/xml/parsing/MarkupParser.scala index 6e2c0bfbbe..e92a78d696 100644 --- a/sources/scala/xml/parsing/MarkupParser.scala +++ b/sources/scala/xml/parsing/MarkupParser.scala @@ -95,13 +95,13 @@ abstract class MarkupParser[MarkupType, AVType] { nextch; val tmp = xAttributeValue(delim); nextch; - handle.attributeCDataValue( pos1, tmp ); + handle.attribute( pos1, key, tmp ); /*case '{' if enableEmbeddedExpressions => nextch; handle.attributeEmbedded(pos1, xEmbeddedExpr);*/ case _ => reportSyntaxError( "' or \" delimited attribute value or '{' scala-expr '}' expected" ); - handle.attributeCDataValue( pos1, "<syntax-error>" ) + handle.attribute( pos1, key, "<syntax-error>" ) }; // well-formedness constraint: unique attribute names if (aMap.contains(key)) @@ -302,6 +302,8 @@ abstract class MarkupParser[MarkupType, AVType] { * | xmlTag1 '/' '>' */ def element: MarkupType = { + xSpaceOpt; // @todo: move this to init + xToken('<'); var pref: Map[String, String] = _; var pos1 = pos; val qname = xTag; |