New test.
[mono.git] / mcs / class / Microsoft.Web.Services / Microsoft.Web.Services.Addressing / AttributedQName.cs
1 //
2 // Microsoft.Web.Services.Addressing.AttributedQName.cs
3 //
4 // Author: Todd Berman <tberman@gentoo.org>
5 //
6 // (C) 2003 Todd Berman
7
8 using System;
9 using System.Xml;
10 using Microsoft.Web.Services.Xml;
11
12 namespace Microsoft.Web.Services.Addressing
13 {
14
15         public class AttributedQName : OpenAttributeElement
16         {
17
18                 private QualifiedName _qname;
19
20                 public AttributedQName (QualifiedName qname) : base ()
21                 {
22                         if(qname == null) {
23                                 throw new ArgumentNullException ("qname");
24                         }
25                         _qname = qname;
26                 }
27
28                 public AttributedQName () : base ()
29                 {
30                 }
31
32                 public void GetXmlQName (XmlDocument document, XmlElement element)
33                 {
34                         if(document == null) {
35                                 throw new ArgumentNullException ("document");
36                         }
37                         if(element == null) {
38                                 throw new ArgumentNullException ("document");
39                         }
40
41                         GetXmlAny (document, element);
42                         _qname.GetQualifiedName (document, element);
43                 }
44
45                 public void LoadXmlQName (XmlElement element)
46                 {
47                         ValidateSchema (element);
48
49                         LoadXmlAny (element);
50
51                         _qname = QualifiedName.FromString (element.InnerText, element);
52                 }
53
54                 public void ValidateSchema (XmlElement element)
55                 {
56                         if(element.ChildNodes.Count > 1) {
57                                 throw new AddressingFormatException ("wsa_InvalidQName");
58                         }
59                 }
60
61                 public QualifiedName Value {
62                         get { return _qname; }
63                         set { _qname = value; }
64                 }
65
66         }
67
68 }