diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/xmldocument | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/xmldocument')
-rw-r--r-- | files/zh-cn/web/api/xmldocument/async/index.html | 30 | ||||
-rw-r--r-- | files/zh-cn/web/api/xmldocument/index.html | 68 | ||||
-rw-r--r-- | files/zh-cn/web/api/xmldocument/load/index.html | 35 |
3 files changed, 133 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/xmldocument/async/index.html b/files/zh-cn/web/api/xmldocument/async/index.html new file mode 100644 index 0000000000..f1e29dee9d --- /dev/null +++ b/files/zh-cn/web/api/xmldocument/async/index.html @@ -0,0 +1,30 @@ +--- +title: XMLDocument.async +slug: Web/API/XMLDocument/async +translation_of: Web/API/XMLDocument/async +--- +<p>{{APIRef("DOM")}}{{Non-standard_header}}{{Deprecated_header}}</p> + +<p><code>document.async</code> 可以被赋值,用来表明 <code><a href="/zh-cn/DOM/document.load" title="zh-cn/DOM/document.load">document.load</a></code> 被调用时,是使用异步模式还是同步模式进行请求. <code>true</code> 为默认值, 表明该文档应该被异步加载.</p> + +<p>(从Gecko 1.4alpha 开始,文档请求可以以异步模式进行,在这之前,只有同步模式可用.)</p> + +<h2 id="Code_example" name="Code_example">代码示例</h2> + +<pre>function loadXMLData(e) +{ +alert(new XMLSerializer().serializeToString(e.target)); // 返回一个包含querydata.xml内容的字符串. +} + +var xmlDoc = document.implementation.createDocument("", "test", null); +xmlDoc.async = false; +xmlDoc.onload = loadXMLData; +xmlDoc.load('querydata.xml'); +</pre> + +<h2 id="See_also" name="See_also">相关链接</h2> + +<ul> + <li><a href="/zh-cn/XML_in_Mozilla" title="zh-cn/XML_in_Mozilla">XML in Mozilla</a></li> + <li>{{DOMxRef("XMLDocument.load()")}}</li> +</ul> diff --git a/files/zh-cn/web/api/xmldocument/index.html b/files/zh-cn/web/api/xmldocument/index.html new file mode 100644 index 0000000000..4bac602b27 --- /dev/null +++ b/files/zh-cn/web/api/xmldocument/index.html @@ -0,0 +1,68 @@ +--- +title: XMLDocument +slug: Web/API/XMLDocument +tags: + - API + - DOM + - XML + - 参考 + - 接口 +translation_of: Web/API/XMLDocument +--- +<p>{{APIRef("DOM")}}</p> + +<p>The <strong>XMLDocument</strong> interface represents an XML document. It inherits from the generic {{DOMxRef("Document")}} and does not add any specific methods or properties to it: nevertheless, several algorithms behave differently with the two types of documents.</p> + +<p>{{InheritanceDiagram}}</p> + +<h2 id="属性">属性</h2> + +<p><em>Also inherits properties from: {{DOMxRef("Document")}}</em></p> + +<dl> + <dt>{{DOMxRef("XMLDocument.async")}} {{Non-standard_Inline}} {{Deprecated_Inline}}</dt> + <dd>Used with {{DOMxRef("XMLDocument.load()")}} to indicate an asynchronous request.</dd> +</dl> + +<h2 id="方法">方法</h2> + +<p><em>Also inherits methods from: {{DOMxRef("Document")}}</em></p> + +<dl> + <dt>{{DOMxRef("XMLDocument.load()")}} {{Non-standard_Inline}} {{Deprecated_Inline}}</dt> + <dd>Loads an XML document.</dd> +</dl> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">规范</th> + <th scope="col">状态</th> + <th scope="col">备注</th> + </tr> + <tr> + <td>{{SpecName("DOM WHATWG", "#xmldocument", "XMLDocument")}}</td> + <td>{{Spec2("DOM WHATWG")}}</td> + <td>没有变化。</td> + </tr> + <tr> + <td>{{SpecName("DOM4", "#xmldocument", "XMLDocument")}}</td> + <td>{{Spec2("DOM4")}}</td> + <td>初步定义。</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + + + +<p>{{Compat("api.XMLDocument")}}</p> + +<h2 id="另请参见">另请参见</h2> + +<ul> + <li><a href="/zh-CN/docs/Web/API/Document_Object_Model">DOM 接口索引</a></li> +</ul> diff --git a/files/zh-cn/web/api/xmldocument/load/index.html b/files/zh-cn/web/api/xmldocument/load/index.html new file mode 100644 index 0000000000..2ba7774606 --- /dev/null +++ b/files/zh-cn/web/api/xmldocument/load/index.html @@ -0,0 +1,35 @@ +--- +title: XMLDocument.load() +slug: Web/API/XMLDocument/load +translation_of: Web/API/XMLDocument/load +--- +<p>{{APIRef("DOM")}}</p> + +<p><code>document.load()</code>作为旧版的w3c标准 <a class="external" href="http://www.w3.org/TR/2003/WD-DOM-Level-3-LS-20030619/load-save.html#LS-DocumentLS">DOM Level 3 Load & Save module</a> 其中的一部分. <a href="/zh-cn/DOM/document.async" title="zh-cn/DOM/document.async">document.async</a> 用来表明该请求是以同步模式进行还是异步模式进行(默认值). 从 Gecko 1.9开始 ,该方法不支持跨站的文档请求.(使用 <a href="/zh-cn/DOM/XMLHttpRequest" title="zh-cn/XMLHttpRequest">XMLHttpRequest</a> 代替).</p> + +<h3 id="代码示例">代码示例</h3> + +<pre>var xmlDoc = document.implementation.createDocument("", "test", null); +function documentLoaded (e) { + alert(new XMLSerializer().serializeToString(e.target)); // 返回一个包含querydata.xml内容的字符串. +} +xmlDoc.addEventListener("load", documentLoaded, false); +xmlDoc.load('querydata.xml'); +</pre> + +<p>在XML/tests目录下{{ Source("content/xml/tests/load/", "查看load示例") }} . (在LXR生成的页面内加载load.html文件是无效的,因为LXR会将test.xml合并到load.html中作为一个单独的HTML页面返回. 为了测试这个功能,你可以在自己的本地磁盘或网络服务器上创建测试文件.)</p> + +<h3 id="相关链接">相关链接</h3> + +<ul> + <li><a href="/zh-cn/DOM/document.async" title="zh-cn/DOM/document.async">document.async</a></li> + <li><a href="/zh-cn/XML_in_Mozilla" title="zh-cn/XML_in_Mozilla">XML in Mozilla</a></li> +</ul> + +<h3 id="规范">规范</h3> + +<ul> + <li><a class="external" href="http://www.w3.org/TR/2003/WD-DOM-Level-3-LS-20030619/load-save.html#LS-DocumentLS">Old W3C Working Draft of the DOM Level 3 Load & Save module</a></li> +</ul> + +<p>{{ languages( {"en": "en/DOM/document.load" } ) }}</p> |