Il modulo XML Extras

This is an archived page. It's not actively maintained.


Il modulo XML Extras contiene diverse funzionalità che permettono agli sviluppatori di trattare un documento XML come un insieme di dati e non semplicemente come un documento di qualsiasi altro tipo. Il modulo è strutturato come componente incorporato e rende disponibili le sue caratteristiche sia tramite JavaScript, sia tramite C++/XPCOM. Il modulo è compilato per default su tutte le piattaforme ed è incluso ance dagli installer, in modo che sia disponibile anche con le nightly builds.

Stato delle funzionalità

Funzionalità Stato
XMLSerializer Disponibile
XMLHttpRequest Disponibile
DOMParser (string and stream input source) Disponibile
Web Services con SOAP e WSDL Disponibile a partire da 1.4alpha. Spostato nel modulo Web Services a partire da 1.4beta.
XML Persistence  
FIXptr e XPointer Disponibile da 1.4alpha nel cuore di Mozilla. Spostato nel modulo XMLExtras a partire da 1.4beta.

Vedere anche:

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.


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()."aHost") ok <tt>file://</tt> documents can access <tt>http://</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, "" and "" 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.