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 |
XMLSerializer | Available |
XMLHttpRequest | Available |
DOMParser (string and stream input source) | Available |
Web Services with SOAP and WSDL | No longer available from Gecko 1.9/Firefox 3. |
XML Persistence | |
FIXptr and XPointer | Available since 1.4alpha in the core Mozilla. Moved to XML Extras during 1.4beta. |
See also:
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:
extensions/xmlextras/tests/
.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 | file:// 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 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.
XMLSerializer()
)DOMParser()
)Please see the XML Linking and Pointing section in XML in Mozilla document for FIXptr and XPointer documentation.