w3c_xml.js (11146B)
1 /* 2 * Copyright 2008 The Closure Compiler Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /** 18 * @fileoverview Definitions for W3C's XML related specifications. 19 * This file depends on w3c_dom2.js. 20 * The whole file has been fully type annotated. 21 * 22 * Provides the XML standards from W3C. 23 * Includes: 24 * XPath - Fully type annotated 25 * XMLHttpRequest - Fully type annotated 26 * 27 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html 28 * @see http://www.w3.org/TR/XMLHttpRequest/ 29 * @see http://www.w3.org/TR/XMLHttpRequest2/ 30 * 31 * @externs 32 * @author stevey@google.com (Steve Yegge) 33 */ 34 35 36 /** 37 * @constructor 38 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathException 39 */ 40 function XPathException() {} 41 42 /** 43 * @type {number} 44 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#INVALID_EXPRESSION_ERR 45 */ 46 XPathException.INVALID_EXPRESSION_ERR = 52; 47 48 /** 49 * @type {number} 50 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#TYPE_ERR 51 */ 52 XPathException.TYPE_ERR = 52; 53 54 /** 55 * @type {number} 56 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html# 57 */ 58 XPathException.prototype.code; 59 60 /** 61 * @constructor 62 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathEvaluator 63 */ 64 function XPathEvaluator() {} 65 66 /** 67 * @param {string} expr 68 * @param {?XPathNSResolver=} opt_resolver 69 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathEvaluator-createExpression 70 * @throws XPathException 71 * @throws DOMException 72 */ 73 XPathEvaluator.prototype.createExpression = function(expr, opt_resolver) {}; 74 75 /** 76 * @param {Node} nodeResolver 77 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathEvaluator-createNSResolver 78 */ 79 XPathEvaluator.prototype.createNSResolver = function(nodeResolver) {}; 80 81 /** 82 * @param {string} expr 83 * @param {Node} contextNode 84 * @param {?XPathNSResolver=} opt_resolver 85 * @param {?number=} opt_type 86 * @param {*=} opt_result 87 * @return {XPathResult} 88 * @throws XPathException 89 * @throws DOMException 90 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathEvaluator-evaluate 91 */ 92 XPathEvaluator.prototype.evaluate = function(expr, contextNode, opt_resolver, 93 opt_type, opt_result) {}; 94 95 96 /** 97 * @constructor 98 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathExpression 99 */ 100 function XPathExpression() {} 101 102 /** 103 * @param {Node} contextNode 104 * @param {number=} opt_type 105 * @param {*=} opt_result 106 * @return {*} 107 * @throws XPathException 108 * @throws DOMException 109 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathExpression-evaluate 110 */ 111 XPathExpression.prototype.evaluate = function(contextNode, opt_type, 112 opt_result) {}; 113 114 115 /** 116 * @constructor 117 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathNSResolver 118 */ 119 function XPathNSResolver() {} 120 121 /** 122 * @param {string} prefix 123 * @return {?string} 124 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathNSResolver-lookupNamespaceURI 125 */ 126 XPathNSResolver.prototype.lookupNamespaceURI = function(prefix) {}; 127 128 /** 129 * From http://www.w3.org/TR/xpath 130 * 131 * XPath is a language for addressing parts of an XML document, designed to be 132 * used by both XSLT and XPointer. 133 * 134 * @noalias 135 * @constructor 136 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult 137 */ 138 function XPathResult() {} 139 140 /** 141 * @type {boolean} {@see XPathException.TYPE_ERR} 142 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult-booleanValue 143 */ 144 XPathResult.prototype.booleanValue; 145 146 /** 147 * @type {boolean} {@see XPathException.TYPE_ERR} 148 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult-invalid-iterator-state 149 */ 150 XPathResult.prototype.invalidInteratorState; 151 152 /** 153 * @type {number} 154 * @throws XPathException {@see XPathException.TYPE_ERR} 155 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult-numberValue 156 */ 157 XPathResult.prototype.numberValue; 158 159 /** 160 * @type {number} 161 * @throws XPathException {@see XPathException.TYPE_ERR} 162 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult-resultType 163 */ 164 XPathResult.prototype.resultType; 165 166 /** 167 * @type {Node} 168 * @throws XPathException {@see XPathException.TYPE_ERR} 169 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult-singleNodeValue 170 */ 171 XPathResult.prototype.singleNodeValue; 172 173 /** 174 * @type {number} 175 * @throws XPathException {@see XPathException.TYPE_ERR} 176 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult-snapshot-length 177 */ 178 XPathResult.prototype.snapshotLength; 179 180 /** 181 * @type {string} 182 * @throws XPathException {@see XPathException.TYPE_ERR} 183 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult-stringValue 184 */ 185 XPathResult.prototype.stringValue; 186 187 /** 188 * @return {Node} 189 * @throws XPathException {@see XPathException.TYPE_ERR} 190 * @throws DOMException {@see DOMException.INVALID_STATE_ERR} 191 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult-iterateNext 192 */ 193 XPathResult.prototype.iterateNext = function() {}; 194 195 /** 196 * @param {number} index 197 * @return {Node} 198 * @throws XPathException 199 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult-snapshotItem 200 */ 201 XPathResult.prototype.snapshotItem = function(index) {}; 202 203 /** 204 * @type {number} 205 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult-ANY-TYPE 206 */ 207 XPathResult.ANY_TYPE = 0; 208 209 /** 210 * @type {number} 211 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult-NUMBER-TYPE 212 */ 213 XPathResult.NUMBER_TYPE = 1; 214 215 /** 216 * @type {number} 217 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult-STRING-TYPE 218 */ 219 XPathResult.STRING_TYPE = 2; 220 221 /** 222 * @type {number} 223 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult-BOOLEAN-TYPE 224 */ 225 XPathResult.BOOLEAN_TYPE = 3; 226 227 /** 228 * @type {number} 229 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult-UNORDERED-NODE-ITERATOR-TYPE 230 */ 231 XPathResult.UNORDERED_NODE_ITERATOR_TYPE = 4; 232 233 /** 234 * @type {number} 235 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult-ORDERED-NODE-ITERATOR-TYPE 236 */ 237 XPathResult.ORDERED_NODE_ITERATOR_TYPE = 5; 238 239 /** 240 * @type {number} 241 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult-UNORDERED-NODE-SNAPSHOT-TYPE 242 */ 243 XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE = 6; 244 245 /** 246 * @type {number} 247 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult-ORDERED-NODE-SNAPSHOT-TYPE 248 */ 249 XPathResult.ORDERED_NODE_SNAPSHOT_TYPE = 7; 250 251 /** 252 * @type {number} 253 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult-ANY-UNORDERED-NODE-TYPE 254 */ 255 XPathResult.ANY_UNORDERED_NODE_TYPE = 8; 256 257 /** 258 * @type {number} 259 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult-FIRST-ORDERED-NODE-TYPE 260 */ 261 XPathResult.FIRST_ORDERED_NODE_TYPE = 9; 262 263 /** 264 * @constructor 265 * @extends {Node} 266 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathNamespace 267 */ 268 function XPathNamespace() {} 269 270 /** 271 * @type {Element} 272 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathNamespace-ownerElement 273 */ 274 XPathNamespace.prototype.ownerElement; 275 276 /** 277 * @type {number} 278 * @see http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPATH_NAMESPACE_NODE 279 */ 280 XPathNamespace.XPATH_NAMESPACE_NODE = 13; 281 282 /** 283 * From http://www.w3.org/TR/XMLHttpRequest/ 284 * 285 * (Draft) 286 * 287 * The XMLHttpRequest Object specification defines an API that provides 288 * scripted client functionality for transferring data between a client and a 289 * server. 290 * 291 * @constructor 292 * @implements {EventTarget} 293 * @see http://www.w3.org/TR/XMLHttpRequest/#xmlhttprequest-object 294 */ 295 function XMLHttpRequest() {} 296 297 /** 298 * @param {boolean=} opt_useCapture 299 * @override 300 */ 301 XMLHttpRequest.prototype.addEventListener = 302 function(type, listener, opt_useCapture) {}; 303 304 /** 305 * @param {boolean=} opt_useCapture 306 * @override 307 */ 308 XMLHttpRequest.prototype.removeEventListener = 309 function(type, listener, opt_useCapture) {}; 310 311 /** @override */ 312 XMLHttpRequest.prototype.dispatchEvent = function(evt) {}; 313 314 /** 315 * @param {string} method 316 * @param {string} url 317 * @param {?boolean=} opt_async 318 * @param {?string=} opt_user 319 * @param {?string=} opt_password 320 * @return {undefined} 321 * @see http://www.w3.org/TR/XMLHttpRequest/#the-open()-method 322 */ 323 XMLHttpRequest.prototype.open = function(method, url, opt_async, opt_user, 324 opt_password) {}; 325 326 /** 327 * @param {string} header 328 * @param {string} value 329 * @return {undefined} 330 * @see http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader()-method 331 */ 332 XMLHttpRequest.prototype.setRequestHeader = function(header, value) {}; 333 334 /** 335 * @param {ArrayBuffer|ArrayBufferView|Blob|Document|FormData|string=} opt_data 336 * @return {undefined} 337 * @see http://www.w3.org/TR/XMLHttpRequest/#the-send()-method 338 */ 339 XMLHttpRequest.prototype.send = function(opt_data) {}; 340 341 /** 342 * @return {undefined} 343 * @see http://www.w3.org/TR/XMLHttpRequest/#the-abort()-method 344 */ 345 XMLHttpRequest.prototype.abort = function() {}; 346 347 /** 348 * @return {string} 349 * @see http://www.w3.org/TR/XMLHttpRequest/#the-getallresponseheaders()-method 350 */ 351 XMLHttpRequest.prototype.getAllResponseHeaders = function() {}; 352 353 /** 354 * @param {string} header 355 * @return {string} 356 * @see http://www.w3.org/TR/XMLHttpRequest/#the-getresponseheader()-method 357 */ 358 XMLHttpRequest.prototype.getResponseHeader = function(header) {}; 359 360 /** 361 * @type {string} 362 * @see http://www.w3.org/TR/XMLHttpRequest/#the-responsetext-attribute 363 */ 364 XMLHttpRequest.prototype.responseText; 365 366 /** 367 * @type {Document} 368 * @see http://www.w3.org/TR/XMLHttpRequest/#the-responsexml-attribute 369 */ 370 XMLHttpRequest.prototype.responseXML; 371 372 /** 373 * @type {number} 374 * @see http://www.w3.org/TR/XMLHttpRequest/#the-readystate-attribute 375 */ 376 XMLHttpRequest.prototype.readyState; 377 378 /** 379 * @type {number} 380 * @see http://www.w3.org/TR/XMLHttpRequest/#the-status-attribute 381 */ 382 XMLHttpRequest.prototype.status; 383 384 /** 385 * @type {string} 386 * @see http://www.w3.org/TR/XMLHttpRequest/#the-statustext-attribute 387 */ 388 XMLHttpRequest.prototype.statusText; 389 390 /** 391 * @type {Function} 392 * @see http://www.w3.org/TR/XMLHttpRequest/#handler-xhr-onreadystatechange 393 */ 394 XMLHttpRequest.prototype.onreadystatechange; 395 396 /** 397 * @type {Function} 398 * @see http://www.w3.org/TR/XMLHttpRequest/#handler-xhr-onerror 399 */ 400 XMLHttpRequest.prototype.onerror; 401 402 /** 403 * The FormData object represents an ordered collection of entries. Each entry 404 * has a name and value. 405 * 406 * @param {?Element=} opt_form An optional form to use for constructing the form 407 * data set. 408 * @constructor 409 * @see http://www.w3.org/TR/XMLHttpRequest2/#the-formdata-interface 410 */ 411 function FormData(opt_form) {} 412 413 /** 414 * @param {string} name 415 * @param {Blob|string} value 416 */ 417 FormData.prototype.append = function(name, value) {};