JSXML XML Tools

Version 1.3
JavaScript XML Library, released under the LGPL license - created by Level Three Solutions

JSXML includes REXML, a high-performance parser that doesn't mind if you throw 2000 lines of (well-formed) XML at it, a builder with a unique API that invites the coding of GUIs (graphical user interfaces) around it, and an iterator that makes costly recursion unnecessary. It was released under the LGPL (it's free for private and commercial use, no strings attached) and has been downloaded over 300 times.

JSXML includes
  • REXML - a light-weight regular expression-based XML parser
    • Gives you programatic access to XML documents.
    • Integrates with the JSXMLBuilder and JSXMLIterator
    • The fastest JavaScript XML Parser available
  • REXML Lite - a stripped down version of REXML
    • Whitespace has been removed and internal variables renamed - file size is 1.9 KB!
    • No support for text, cdata, and pi elements (however text is still accessible through the text property of an element).
    • Text property of elements doesn't include text of that element's children
    • Interchangable with REXML, as long as no unsupported functions are accessed
  • JSXMLBuilder - a flat interface to modify XML
    • JSXMLBuilder makes it easier to program GUIs that leverage the flexibility of XML
      To tree or not to tree?
      Most APIs for XML use a tree structure, which initially seems to be the right approach given that XML is itself tree-stuctured. However, anyone who has built a user interface which uses XML via MSXML or another tree-structured API knows as soon as there are several user actions that result in XML modifications, the code quickly become unmanageable. Therefore the JSXMLBuilder object takes the tree structure from REXML and makes it accessbile with a flat interface. The childElement and parentElement methods are still available, but there are many other ways to access and manipulate elements, making it very convenient to alter pieces of the XML directly from events in the GUI, without navigating through the API hunting for elements.
    • Text is not stored as a child element, and there is no support for comment, cdata, and pi type elements. Text is accessed and writable through the text property of an element.
  • JSXMLIterator - a tool to iterate the tree structure of a REXML object without using recursion


Because it is based on regular expressions and uses efficient JavaScript code, REXML is extremely fast. Take a look at these comparisons (click the image to enlarge):

Figure 1:
Notice that at one point REXML is faster than MSXML, which is compiled code and only works in recent versions of Internet Explorer (REXML is cross-browser compatible). Also, initializing MSXML for the first time costs you 200 MS on an everyday computer, which is not counted here but in cases of one-time use REXML is faster for anything less than 2000 lines!


Figure 2:


Xparse (V .91)
XML For Script (V .22)


The test area allows you to perform a live run of each of the parsers' main functions against any XML.

For comments, a list of issues, or to submit an new issue see: http://sourceforge.net/projects/jsxml/
SourceForge Logo