1 Clazz.declarePackage ("org.xml.sax.helpers");
\r
2 Clazz.load (["java.util.Vector"], "org.xml.sax.helpers.NamespaceSupport", ["java.lang.IllegalStateException", "java.util.EmptyStackException", "$.Hashtable"], function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
4 this.contexts = null;
\r
5 this.currentContext = null;
\r
7 this.namespaceDeclUris = false;
\r
8 if (!Clazz.isClassDefined ("org.xml.sax.helpers.NamespaceSupport.Context")) {
\r
9 org.xml.sax.helpers.NamespaceSupport.$NamespaceSupport$Context$ ();
\r
11 Clazz.instantialize (this, arguments);
\r
12 }, org.xml.sax.helpers, "NamespaceSupport");
\r
13 Clazz.makeConstructor (c$,
\r
17 Clazz.defineMethod (c$, "reset",
\r
19 this.contexts = new Array (32);
\r
20 this.namespaceDeclUris = false;
\r
21 this.contextPos = 0;
\r
22 this.contexts[this.contextPos] = this.currentContext = Clazz.innerTypeInstance (org.xml.sax.helpers.NamespaceSupport.Context, this, null);
\r
23 this.currentContext.declarePrefix ("xml", "http://www.w3.org/XML/1998/namespace");
\r
25 Clazz.defineMethod (c$, "pushContext",
\r
27 var max = this.contexts.length;
\r
28 this.contexts[this.contextPos].declsOK = false;
\r
30 if (this.contextPos >= max) {
\r
31 var newContexts = new Array (max * 2);
\r
32 System.arraycopy (this.contexts, 0, newContexts, 0, max);
\r
34 this.contexts = newContexts;
\r
35 }this.currentContext = this.contexts[this.contextPos];
\r
36 if (this.currentContext == null) {
\r
37 this.contexts[this.contextPos] = this.currentContext = Clazz.innerTypeInstance (org.xml.sax.helpers.NamespaceSupport.Context, this, null);
\r
38 }if (this.contextPos > 0) {
\r
39 this.currentContext.setParent (this.contexts[this.contextPos - 1]);
\r
41 Clazz.defineMethod (c$, "popContext",
\r
43 this.contexts[this.contextPos].clear ();
\r
45 if (this.contextPos < 0) {
\r
46 throw new java.util.EmptyStackException ();
\r
47 }this.currentContext = this.contexts[this.contextPos];
\r
49 Clazz.defineMethod (c$, "declarePrefix",
\r
50 function (prefix, uri) {
\r
51 if (prefix.equals ("xml") || prefix.equals ("xmlns")) {
\r
54 this.currentContext.declarePrefix (prefix, uri);
\r
57 Clazz.defineMethod (c$, "processName",
\r
58 function (qName, parts, isAttribute) {
\r
59 var myParts = this.currentContext.processName (qName, isAttribute);
\r
60 if (myParts == null) {
\r
63 parts[0] = myParts[0];
\r
64 parts[1] = myParts[1];
\r
65 parts[2] = myParts[2];
\r
68 Clazz.defineMethod (c$, "getURI",
\r
70 return this.currentContext.getURI (prefix);
\r
72 Clazz.defineMethod (c$, "getPrefixes",
\r
74 return this.currentContext.getPrefixes ();
\r
76 Clazz.defineMethod (c$, "getPrefix",
\r
78 return this.currentContext.getPrefix (uri);
\r
80 Clazz.defineMethod (c$, "getPrefixes",
\r
82 var prefixes = new java.util.Vector ();
\r
83 var allPrefixes = this.getPrefixes ();
\r
84 while (allPrefixes.hasMoreElements ()) {
\r
85 var prefix = allPrefixes.nextElement ();
\r
86 if (uri.equals (this.getURI (prefix))) {
\r
87 prefixes.addElement (prefix);
\r
89 return prefixes.elements ();
\r
91 Clazz.defineMethod (c$, "getDeclaredPrefixes",
\r
93 return this.currentContext.getDeclaredPrefixes ();
\r
95 Clazz.defineMethod (c$, "setNamespaceDeclUris",
\r
97 if (this.contextPos != 0) throw new IllegalStateException ();
\r
98 if (value == this.namespaceDeclUris) return;
\r
99 this.namespaceDeclUris = value;
\r
100 if (value) this.currentContext.declarePrefix ("xmlns", "http://www.w3.org/xmlns/2000/");
\r
102 this.contexts[this.contextPos] = this.currentContext = Clazz.innerTypeInstance (org.xml.sax.helpers.NamespaceSupport.Context, this, null);
\r
103 this.currentContext.declarePrefix ("xml", "http://www.w3.org/XML/1998/namespace");
\r
105 Clazz.defineMethod (c$, "isNamespaceDeclUris",
\r
107 return this.namespaceDeclUris;
\r
109 c$.$NamespaceSupport$Context$ = function () {
\r
110 Clazz.pu$h(self.c$);
\r
111 c$ = Clazz.decorateAsClass (function () {
\r
112 Clazz.prepareCallback (this, arguments);
\r
113 this.prefixTable = null;
\r
114 this.uriTable = null;
\r
115 this.elementNameTable = null;
\r
116 this.attributeNameTable = null;
\r
117 this.defaultNS = null;
\r
118 this.declsOK = true;
\r
119 this.declarations = null;
\r
120 this.declSeen = false;
\r
121 this.parent = null;
\r
122 Clazz.instantialize (this, arguments);
\r
123 }, org.xml.sax.helpers.NamespaceSupport, "Context");
\r
124 Clazz.makeConstructor (c$,
\r
126 this.copyTables ();
\r
128 Clazz.defineMethod (c$, "setParent",
\r
131 this.declarations = null;
\r
132 this.prefixTable = a.prefixTable;
\r
133 this.uriTable = a.uriTable;
\r
134 this.elementNameTable = a.elementNameTable;
\r
135 this.attributeNameTable = a.attributeNameTable;
\r
136 this.defaultNS = a.defaultNS;
\r
137 this.declSeen = false;
\r
138 this.declsOK = true;
\r
139 }, "org.xml.sax.helpers.NamespaceSupport.Context");
\r
140 Clazz.defineMethod (c$, "clear",
\r
142 this.parent = null;
\r
143 this.prefixTable = null;
\r
144 this.uriTable = null;
\r
145 this.elementNameTable = null;
\r
146 this.attributeNameTable = null;
\r
147 this.defaultNS = null;
\r
149 Clazz.defineMethod (c$, "declarePrefix",
\r
151 if (!this.declsOK) throw new IllegalStateException ("can't declare any more prefixes in this context");
\r
152 if (!this.declSeen) {
\r
153 this.copyTables ();
\r
154 }if (this.declarations == null) {
\r
155 this.declarations = new java.util.Vector ();
\r
158 if ("".equals (a)) {
\r
159 if ("".equals (b)) {
\r
160 this.defaultNS = null;
\r
162 this.defaultNS = b;
\r
164 this.prefixTable.put (a, b);
\r
165 this.uriTable.put (b, a);
\r
166 }this.declarations.addElement (a);
\r
168 Clazz.defineMethod (c$, "processName",
\r
172 this.declsOK = false;
\r
174 d = this.attributeNameTable;
\r
176 d = this.elementNameTable;
\r
180 }c = new Array (3);
\r
181 c[2] = a.intern ();
\r
182 var e = a.indexOf (':');
\r
185 if (a === "xmlns" && this.b$["org.xml.sax.helpers.NamespaceSupport"].namespaceDeclUris) c[0] = "http://www.w3.org/xmlns/2000/";
\r
187 } else if (this.defaultNS == null) {
\r
190 c[0] = this.defaultNS;
\r
193 var f = a.substring (0, e);
\r
194 var g = a.substring (e + 1);
\r
196 if ("".equals (f)) {
\r
197 h = this.defaultNS;
\r
199 h = this.prefixTable.get (f);
\r
200 }if (h == null || (!b && "xmlns".equals (f))) {
\r
203 c[1] = g.intern ();
\r
207 Clazz.defineMethod (c$, "getURI",
\r
209 if ("".equals (a)) {
\r
210 return this.defaultNS;
\r
211 } else if (this.prefixTable == null) {
\r
214 return this.prefixTable.get (a);
\r
216 Clazz.defineMethod (c$, "getPrefix",
\r
218 if (this.uriTable == null) {
\r
221 return this.uriTable.get (a);
\r
223 Clazz.defineMethod (c$, "getDeclaredPrefixes",
\r
225 if (this.declarations == null) {
\r
226 return org.xml.sax.helpers.NamespaceSupport.EMPTY_ENUMERATION;
\r
228 return this.declarations.elements ();
\r
230 Clazz.defineMethod (c$, "getPrefixes",
\r
232 if (this.prefixTable == null) {
\r
233 return org.xml.sax.helpers.NamespaceSupport.EMPTY_ENUMERATION;
\r
235 return this.prefixTable.keys ();
\r
237 Clazz.defineMethod (c$, "copyTables",
\r
239 if (this.prefixTable != null) {
\r
240 this.prefixTable = this.prefixTable.clone ();
\r
242 this.prefixTable = new java.util.Hashtable ();
\r
243 }if (this.uriTable != null) {
\r
244 this.uriTable = this.uriTable.clone ();
\r
246 this.uriTable = new java.util.Hashtable ();
\r
247 }this.elementNameTable = new java.util.Hashtable ();
\r
248 this.attributeNameTable = new java.util.Hashtable ();
\r
249 this.declSeen = true;
\r
253 Clazz.defineStatics (c$,
\r
254 "XMLNS", "http://www.w3.org/XML/1998/namespace",
\r
255 "NSDECL", "http://www.w3.org/xmlns/2000/");
\r
256 c$.EMPTY_ENUMERATION = c$.prototype.EMPTY_ENUMERATION = new java.util.Vector ().elements ();
\r