1 // 2 // System.Runtime.Remoting.Metadata.W3cXsd2001.SoapQName.cs 3 // 4 // Authors: 5 // Martin Willemoes Hansen (mwh@sysrq.dk) 6 // Lluis Sanchez Gual (lluis@ximian.com) 7 // 8 // (C) 2003 Martin Willemoes Hansen 9 // 10 11 // 12 // Copyright (C) 2004 Novell, Inc (http://www.novell.com) 13 // 14 // Permission is hereby granted, free of charge, to any person obtaining 15 // a copy of this software and associated documentation files (the 16 // "Software"), to deal in the Software without restriction, including 17 // without limitation the rights to use, copy, modify, merge, publish, 18 // distribute, sublicense, and/or sell copies of the Software, and to 19 // permit persons to whom the Software is furnished to do so, subject to 20 // the following conditions: 21 // 22 // The above copyright notice and this permission notice shall be 23 // included in all copies or substantial portions of the Software. 24 // 25 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 29 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 30 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 31 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 32 // 33 34 using System; 35 36 namespace System.Runtime.Remoting.Metadata.W3cXsd2001 37 { 38 [Serializable] 39 [System.Runtime.InteropServices.ComVisible (true)] 40 public sealed class SoapQName : ISoapXsd 41 { 42 string _name; 43 string _key; 44 string _namespace; 45 SoapQName()46 public SoapQName () 47 { 48 } 49 SoapQName(string value)50 public SoapQName (string value) 51 { 52 _name = value; 53 } 54 SoapQName(string key, string name)55 public SoapQName (string key, string name) 56 { 57 _key = key; 58 _name = name; 59 } 60 SoapQName(string key, string name, string namespaceValue)61 public SoapQName (string key, string name, string namespaceValue) 62 { 63 _key = key; 64 _name = name; 65 _namespace = namespaceValue; 66 } 67 68 public string Key { 69 get { return _key; } 70 set { _key = value; } 71 } 72 73 public string Name { 74 get { return _name; } 75 set { _name = value; } 76 } 77 78 public string Namespace { 79 get { return _namespace; } 80 set { _namespace = value; } 81 } 82 83 public static string XsdType { 84 get { return "QName"; } 85 } 86 GetXsdType()87 public string GetXsdType() 88 { 89 return XsdType; 90 } 91 Parse(string value)92 public static SoapQName Parse (string value) 93 { 94 SoapQName res = new SoapQName (); 95 int i = value.IndexOf (':'); 96 if (i != -1) 97 { 98 res.Key = value.Substring (0,i); 99 res.Name = value.Substring (i+1); 100 } 101 else 102 res.Name = value; 103 return res; 104 } 105 ToString()106 public override string ToString() 107 { 108 if (_key == null || _key == "") return _name; 109 else return _key + ":" + _name; 110 } 111 } 112 } 113