2004-03-20 Sebastien Pouliot <sebastien@ximian.com>
[mono.git] / mcs / class / System.Security / System.Security.Cryptography.Xml / Transform.cs
1 //
2 // Transform.cs - Transform implementation for XML Signature
3 //
4 // Author:
5 //      Sebastien Pouliot <sebastien@ximian.com>
6 //
7 // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
8 // (C) 2004 Novell (http://www.novell.com)
9 //
10
11 using System.Runtime.InteropServices;
12 using System.Xml;
13
14 namespace System.Security.Cryptography.Xml { 
15
16         public abstract class Transform {
17
18                 private string algo;
19
20                 public Transform () {}
21
22                 public string Algorithm {
23                         get { return algo; }
24                         set { algo = value; }
25                 }
26
27                 public abstract Type[] InputTypes {
28                         get;
29                 }
30
31                 public abstract Type[] OutputTypes {
32                         get;
33                 }
34
35                 protected abstract XmlNodeList GetInnerXml ();
36
37                 public abstract object GetOutput ();
38
39                 public abstract object GetOutput (Type type);
40
41                 public XmlElement GetXml () 
42                 {
43                         XmlDocument document = new XmlDocument ();
44                         XmlElement xel = document.CreateElement (XmlSignature.ElementNames.Transform, XmlSignature.NamespaceURI);
45                         xel.SetAttribute (XmlSignature.AttributeNames.Algorithm, algo);
46                         XmlNodeList xnl = this.GetInnerXml ();
47                         if (xnl != null) {
48                                 foreach (XmlNode xn in xnl) {
49                                         XmlNode importedNode = document.ImportNode (xn, true);
50                                         xel.AppendChild (importedNode);
51                                 }
52                         }
53                         return xel;
54                 }
55
56                 public abstract void LoadInnerXml (XmlNodeList nodeList);
57
58                 public abstract void LoadInput (object obj);
59
60 #if ! NET_1_0
61                 private XmlResolver xmlResolver;
62
63                 [ComVisible(false)]
64                 public XmlResolver Resolver {
65                         set { xmlResolver = value; }
66                 }
67                 
68                 internal XmlResolver GetResolver ()
69                 {
70                         return xmlResolver;
71                 }
72 #endif
73         }
74 }