XML Extras 编辑

The XML Extras module contains several features that allow developers to treat XML as data i.e. not as just another document format. The module is structured as a drop-in component and exposes its XML-as-data features both to JavaScript and C++/XPCOM users. The XML Extras module is built by default on all platforms, and is included in the browser installers so it is available in the nightly builds.

Feature Status

FeatureStatus
XMLSerializerAvailable
XMLHttpRequestAvailable
DOMParser (string and stream input source)Available
Web Services with SOAP and WSDLNo longer available from Gecko 1.9/Firefox 3.
XML Persistence 
FIXptr and XPointerAvailable since 1.4alpha in the core Mozilla. Moved to XML Extras during 1.4beta.

See also:

QA and Testing

There are some online tests for mainly exercising the HTTP GET method via XMLHttpRequest.

Other test cases for each of the implemented components listed above exist in extensions/xmlextras/tests/. More exhaustive test suites need to be created, however. If you'd like to help out with QA, you can do one of the following:

  • Sign up as the QA owner for any of the implemented components. The QA owner will manage the tests associated with their component, act as QA contact for related bugs and help with regression testing.
  • Contribute a test suite or individual tests that use the implemented components. File bugs for new test you have, and/or check them into extensions/xmlextras/tests/.
  • File bugs against the implemented components. Bugs should be filed against the XML component in the Browser product.

Documentation

Probably the best way to learn how to use these technologies is through examples. There are some in extensions/xmlextras/tests/. If you follow that link to look at the examples you will need to look at page source for the HTML documents.

For XMLHttpRequest object you can mostly rely on the Microsoft XMLHttpRequest documentation, with some caveats: all functions and property names begin with a lower case letter and the object creation is different. Some properties are not implemented.

Thad Hoffman has written a document that shows how you can mimic XML Data Islands in Mozilla. Edmond Woychowsky has also written articles on XML Data Islands in Mozilla: "Make XML data islands work in Mozilla", "Build cross-browser XML paging code" and "Implement a flexible shopping cart with XML and ASP". The Mozilla Developer Center has several pages for XMLHttpRequest.

Below are some key differencies in "XML Extras" between Mozilla and Microsoft software:

DifferenceMicrosoftMozilla
Member namesCase insensitive?Begins with lower case letter
XMLHttpRequest Creationnew ActiveXObject("Msxml2.XMLHTTP")new XMLHttpRequest()
XMLHttpRequest.send("some string")okok starting with milestone 0.9.7 (actually nightly 2001-11-28). With older builds, passing strings to send() works only in chrome, see post.html sample. The "workaround" is to use DOMParser object's parseFromString() method to create a document from string, and pass the temporary document into send().
XMLHttpRequest.open("aHost")okfile:// documents can access http:// documents but you need to enable UniversalBrowserRead privilege in your scripts - see the JavaScript Security: Signed Scripts document for more details. Normally your files should reside on a webserver so this shouldn't pose a problem (there you do not need that line either). Additionally, "foo.com:80" and "foo.com:313" are considered different hosts for security purposes. You cannot open a connection to a different host.
DOMParser Creationnot availablenew DOMParser()
XMLSerializer Creationnot availablenew XMLSerializer()

Minimal documentation for the components listed above can be found using Mozilla documentation generated by Doxygen. File new bugs for additional documentation contributions, either specifically aimed at JavaScript developers or to complete & clarify the JavaDoc-style comments in the IDL files.

  • nsIDOMSerializer (Currently, the JavaScript constructor is XMLSerializer())
  • nsIDOMParser (Currently, the JavaScript constructor is DOMParser())
  • nsIXMLHttpRequest

Please see the XML Linking and Pointing section in XML in Mozilla document for FIXptr and XPointer documentation.

How can I help?

  • Help with testing the components contained within the module.
  • Contribute Documentation to the module.
  • Help at the code level, contributing code patches for bug fixes or feature completion.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:131 次

字数:8579

最后编辑:8年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文