Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

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

Feature Status
XMLSerializer Available
XMLHttpRequest Available
DOMParser (string and stream input source) Available
Web Services with SOAP and WSDL Available since 1.4alpha. Moved to Web Services module during 1.4beta.
XML Persistence  
FIXptr and XPointer Available since 1.4alpha in the core Mozilla. Moved to XMLExtras 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:

Difference Microsoft Mozilla
Member names Case insensitive? Begins with lower case letter
XMLHttpRequest Creation new ActiveXObject("Msxml2.XMLHTTP") new XMLHttpRequest()
XMLHttpRequest.send("some string") ok ok 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") ok <tt>file://</tt> documents can access <tt>https://</tt> 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 Creation not available new DOMParser()
XMLSerializer Creation not available new 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.

文档标签和贡献者

标签: 
 此页面的贡献者: ziyunfei, Dbseti
 最后编辑者: ziyunfei,