XML for <SCRIPT> includes a number of add-ons that have been contributed by it's user community.
The Contributed Add-ons pages have the following structure:
General: Introduction and layout of the Contributed Add-ons section
W3C DOM: Partially completed W3C compliant XML Dom parser
Recordset: XML DOM wrapper exposing a recordset-like interface
XML for <SCRIPT> has received a number of useful code contributions
since it was introduced. The "Contributed Add-ons" section of the website
contains a repository of some of these enhancements.
These contributions have not yet been fully documented or tested and are
not part of the core distribution of XML for <SCRIPT>. However, following
the Free Software philosophy of "release early-release often", they are provided
here as-is so the greater community may take advantage of them as quickly
as possible.
Contributions of code, documentation, sample applications and test suites are always
welcome!
W3C DOM
One of the drawbacks to XML for <SCRIPT>'s DOM parser is that it uses
a custom object model that does not follow the W3C's DOM object specification.
The DOM parser contained in this add-on is built on top of XML for <SCRIPT>'s
SAX parser and is much more W3C compliant.
This parser is currently partially completed and not fully functional. It needs
a little tender loving care to fully see the light of day and be useful. However,
once that is finished, XML for <SCRIPT> can offer a fully functional W3C
compliant DOM parser.
At the moment, the parser seems to build it's DOM tree properly. An investigation
is needed into why getElementsByTagName doesn't seem to work properly. Full testing
of all the rest of the methods and properties is needed to ensure it is fully
functional. In addition, documentation, sample code and a test suite need to be built.
Please help this parser see the light of day!
This add-on is located in the contributedAdd-ons/W3CDOM directory. To create
the parser and use it in it's current state, try the following code:
NOTE: Strings.js is probably not needed as xmlsax.js has incorporated
this functionality. If you are interested in contributing to the completion
of this add-on, please ensure that Strings.js is not needed. If it is,
please merge the changes into xmlsax.js so that it can be removed.
<script type="text/javascript" src="DOM.js"></script>
<script type="text/javascript" src="Strings.js"></script>
<script type="text/javascript" src="xmlsax.js"></script>
function createNewW3CDom() {
var xml = ""
+ "<?xml version=\"1.0\"?>"
+ "<root>"
+ "<hello>"
+ "<there>"
+ "hi"
+ "</there>"
+ "</hello>"
+ "</root>";
var parser = new DOMDriver();
var dom = parser.parse(xml);
var doc= dom.getDocumentElement();
var nodeList = doc.getElementsByTagName("hello");
}
The DOM.js and the Strings.js are part of the add-on. The xmlsax.js file is the
standard SAX parser that ships with XML for <SCRIPT>.
Recordset Wrapper:
XML for <SCRIPT>'s XML Recordset Wrapper is contributor James S. Elkins'
answer to the WDDX Recordset API, which he found somewhat awkward to use.
The Recordset class has more (as well as more useful) methods than the WDDX recordset.
Documentation for this add-on can be found in the library file itself. The XML
Recordset Wrapper is located in the contributedAdd-ons/xmlRecordsetWrapper directory.