23 |
#if !ECMA_COMPAT |
#if !ECMA_COMPAT |
24 |
|
|
25 |
using System; |
using System; |
26 |
|
using System.Collections; |
27 |
|
using System.Xml.XPath; |
28 |
|
|
29 |
namespace System.Xml.Xsl |
namespace System.Xml.Xsl |
30 |
{ |
{ |
31 |
public sealed class XsltArgumentList |
public |
32 |
|
#if !CONFIG_FRAMEWORK_2_0 |
33 |
|
sealed |
34 |
|
#endif |
35 |
|
class XsltArgumentList |
36 |
{ |
{ |
37 |
[TODO] |
private Hashtable extensions; |
38 |
|
private Hashtable parameters; |
39 |
|
|
40 |
public XsltArgumentList() |
public XsltArgumentList() |
41 |
{ |
{ |
42 |
throw new NotImplementedException(".ctor"); |
extensions = new Hashtable (); |
43 |
|
parameters = new Hashtable (); |
44 |
} |
} |
45 |
|
|
|
[TODO] |
|
46 |
public void AddExtensionObject(String namespaceUri, Object extension) |
public void AddExtensionObject(String namespaceUri, Object extension) |
47 |
{ |
{ |
48 |
throw new NotImplementedException("AddExtensionObject"); |
if(namespaceUri == null) |
49 |
|
{ |
50 |
|
throw new ArgumentException("namespaceUri"); |
51 |
|
} |
52 |
|
if(namespaceUri == "http://www.w3.org/1999/XSL/Transform") |
53 |
|
{ |
54 |
|
throw new ArgumentException("namespaceUri"); |
55 |
|
} |
56 |
|
if(extensions.Contains (namespaceUri)) |
57 |
|
{ |
58 |
|
throw new ArgumentException("namespaceUri"); |
59 |
|
} |
60 |
|
|
61 |
|
extensions[namespaceUri] = extension; |
62 |
} |
} |
63 |
|
|
|
[TODO] |
|
64 |
public void AddParam(String name, String namespaceUri, Object parameter) |
public void AddParam(String name, String namespaceUri, Object parameter) |
65 |
{ |
{ |
66 |
throw new NotImplementedException("AddParam"); |
XmlQualifiedName qName; |
67 |
|
|
68 |
|
if(namespaceUri == null) |
69 |
|
{ |
70 |
|
throw new ArgumentException("namespaceUri"); |
71 |
|
} |
72 |
|
if(namespaceUri == "http://www.w3.org/1999/XSL/Transform") |
73 |
|
{ |
74 |
|
throw new ArgumentException("namespaceUri"); |
75 |
|
} |
76 |
|
if(name == null) |
77 |
|
{ |
78 |
|
throw new ArgumentException("name"); |
79 |
|
} |
80 |
|
|
81 |
|
qName = new XmlQualifiedName(name, namespaceUri); |
82 |
|
if(parameters.Contains(qName)) |
83 |
|
{ |
84 |
|
throw new ArgumentException("namespaceUri"); |
85 |
|
} |
86 |
|
parameter = ValidateParam(parameter); |
87 |
|
parameters[qName] = parameter; |
88 |
} |
} |
89 |
|
|
|
[TODO] |
|
90 |
public void Clear() |
public void Clear() |
91 |
{ |
{ |
92 |
throw new NotImplementedException("Clear"); |
extensions.Clear(); |
93 |
|
parameters.Clear(); |
94 |
} |
} |
95 |
|
|
|
[TODO] |
|
96 |
public Object GetExtensionObject(String namespaceUri) |
public Object GetExtensionObject(String namespaceUri) |
97 |
{ |
{ |
98 |
throw new NotImplementedException("GetExtensionObject"); |
return extensions[namespaceUri]; |
99 |
} |
} |
100 |
|
|
|
[TODO] |
|
101 |
public Object GetParam(String name, String namespaceUri) |
public Object GetParam(String name, String namespaceUri) |
102 |
{ |
{ |
103 |
throw new NotImplementedException("GetParam"); |
XmlQualifiedName qName; |
104 |
|
|
105 |
|
if(name == null) |
106 |
|
{ |
107 |
|
throw (new ArgumentException("name")); |
108 |
|
} |
109 |
|
qName = new XmlQualifiedName(name, namespaceUri); |
110 |
|
return parameters[qName]; |
111 |
} |
} |
112 |
|
|
|
[TODO] |
|
113 |
public Object RemoveExtensionObject(String namespaceUri) |
public Object RemoveExtensionObject(String namespaceUri) |
114 |
{ |
{ |
115 |
throw new NotImplementedException("RemoveExtensionObject"); |
Object extensionObject = this.GetExtensionObject(namespaceUri); |
116 |
|
extensions.Remove(namespaceUri); |
117 |
|
return extensionObject; |
118 |
} |
} |
119 |
|
|
|
[TODO] |
|
120 |
public Object RemoveParam(String name, String namespaceUri) |
public Object RemoveParam(String name, String namespaceUri) |
121 |
{ |
{ |
122 |
throw new NotImplementedException("RemoveParam"); |
XmlQualifiedName qName = new XmlQualifiedName(name, namespaceUri); |
123 |
|
Object parameter = this.GetParam(name, namespaceUri); |
124 |
|
parameters.Remove(qName); |
125 |
|
return parameter; |
126 |
|
} |
127 |
|
|
128 |
|
private Object ValidateParam(Object parameter) |
129 |
|
{ |
130 |
|
if(parameter is string) |
131 |
|
{ |
132 |
|
return parameter; |
133 |
|
} |
134 |
|
if(parameter is bool) |
135 |
|
{ |
136 |
|
return parameter; |
137 |
|
} |
138 |
|
if(parameter is double) |
139 |
|
{ |
140 |
|
return parameter; |
141 |
|
} |
142 |
|
if(parameter is XPathNavigator) |
143 |
|
{ |
144 |
|
return parameter; |
145 |
|
} |
146 |
|
if(parameter is XPathNodeIterator) |
147 |
|
{ |
148 |
|
return parameter; |
149 |
|
} |
150 |
|
if(parameter is Int16) |
151 |
|
{ |
152 |
|
return (double)(Int16)parameter; |
153 |
|
} |
154 |
|
if(parameter is UInt16) |
155 |
|
{ |
156 |
|
return (double)(UInt16)parameter; |
157 |
|
} |
158 |
|
if(parameter is Int32) |
159 |
|
{ |
160 |
|
return (double)(Int32)parameter; |
161 |
|
} |
162 |
|
if(parameter is Int64) |
163 |
|
{ |
164 |
|
return (double)(Int64)parameter; |
165 |
|
} |
166 |
|
if(parameter is UInt64) |
167 |
|
{ |
168 |
|
return (double)(UInt64)parameter; |
169 |
|
} |
170 |
|
if(parameter is Single) |
171 |
|
{ |
172 |
|
return (double)(Single)parameter; |
173 |
|
} |
174 |
|
if(parameter is decimal) |
175 |
|
{ |
176 |
|
return (double)(decimal)parameter; |
177 |
|
} |
178 |
|
return parameter.ToString(); |
179 |
} |
} |
|
|
|
180 |
} |
} |
181 |
}//namespace |
}//namespace |
182 |
#endif |
#endif |