2003-10-08 Todd Berman <tberman@gentoo.org>
authorTodd Berman <tberman@mono-cvs.ximian.com>
Thu, 9 Oct 2003 04:42:58 +0000 (04:42 -0000)
committerTodd Berman <tberman@mono-cvs.ximian.com>
Thu, 9 Oct 2003 04:42:58 +0000 (04:42 -0000)
        * QualifiedName.cs: Initial implementation of FromString.

svn path=/trunk/mcs/; revision=18790

mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Xml/ChangeLog
mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Xml/QualifiedName.cs

index 5c2bb137b10782b5c1ff622f3f819081925f5481..601287eff495eb96e4a0ce463043e4183e4797f0 100644 (file)
@@ -1,3 +1,7 @@
+2003-10-08  Todd Berman <tberman@gentoo.org>
+
+       * QualifiedName.cs: Initial implementation of FromString.
+
 2003-10-07  Todd Berman <tberman@gentoo.org>
 
        * OpenElementElement.cs: implemented
index 00c825695f15c1721a870c1eb8182083cefc9410..6fc36e15367589f3cd6a1d641a29297cef3d92dd 100644 (file)
@@ -23,13 +23,26 @@ namespace Microsoft.Web.Services.Xml
                        _prefix = prefix;
                }
 
-               [MonoTODO]
                public static QualifiedName FromString (string value, XmlNode node)
                {
                        if(node == null) {
                                throw new ArgumentNullException ("node");
                        }
-                       throw new NotImplementedException ();
+                       if(value.IndexOf(':') > 0) {
+                               string[] strings = value.Split(':');
+
+                               if(strings.Length != 2 || strings[0].Length == 0 || strings[1].Length == 1) {
+                                       throw new FormatException ("xml_ImproperQName");
+                               }
+                               string nspace = node.GetNamespaceOfPrefix (strings[0]);
+                               if(nspace.Length == 0) {
+                                       throw new FormatException ("xml_CouldNotResolveNSPrefix");
+                               }
+
+                               return new QualifiedName (strings[0], strings[1], nspace);
+                       }
+                       
+                       throw new FormatException ("xml_ImproperQName");
                }
 
                public XmlAttribute GetNamespaceDecl (XmlDocument document)