remove svn:executable from .cs files
[mono.git] / mcs / class / Microsoft.Web.Services / Microsoft.Web.Services.Addressing / Address.cs
1 //
2 // Microsoft.Web.Services.Addressing.Address.cs
3 //
4 // Author: Todd Berman <tberman@gentoo.org>
5 //
6 // (C) 2003 Todd Berman
7
8 using System;
9 using System.Net;
10 using System.Xml;
11 using Microsoft.Web.Services.Xml;
12
13 namespace Microsoft.Web.Services.Addressing
14 {
15
16         public class Address : AttributedUri, IXmlElement
17         {
18                 
19                 public Address (Uri uri) : base (uri)
20                 {       
21                 }
22                 
23                 public Address (XmlElement element) : base ()
24                 {
25                         LoadXml (element);
26                 }
27                 
28                 public XmlElement GetXml (XmlDocument document)
29                 {
30                         if(document == null) {
31                                 throw new ArgumentNullException ("document");
32                         }
33
34                         XmlElement element = document.CreateElement ("wsa",
35                                                                      "Address",
36                                                                      "http://schemas.xmlsoap.org/ws/2003/03/addressing");
37                         
38                         GetXmlUri (document, element);
39
40                         return element;
41                         
42                 }
43
44                 public void LoadXml (XmlElement element)
45                 {
46
47                         if(element == null) {
48                                 throw new ArgumentNullException ("element");
49                         }
50                         if(element.LocalName != "Address" || element.NamespaceURI != "http://schemas.xmlsoap.org/ws/2003/03/addressing") {
51                                 throw new ArgumentException ("Invalid Element Supplied");
52                         }
53
54                         LoadXmlUri (element);
55                 
56                 }
57
58                 public static implicit operator Address (Uri uri)
59                 {
60                         return new Address(uri);
61                 }
62
63                 public static implicit operator Uri (Address address)
64                 {
65                         if(address == null) {
66                                 return null;
67                         }
68                         return address.Value;
69                 }
70         }
71 }