Sign In/My Account | View Cart  
advertisement

Article:
 A Survey of APIs and Techniques for Processing XML
Subject: String based API
Date: 2003-08-06 05:38:05
From: Julian Turner

As a version of the Cursor based API, I have developed a JavaScript API for string based access, which provides a compromise between a fully parsed Tree API and Cursor based processing.


The XML is stored as string, as a property of a custom RootNode() object. Accordingly memory usage is based on the length of the string.


From this you can call up light SubNode() objects, which only store the start and end points in the XML string for the RootNode, and have a reference back to the RootNode (and therefore the XML string to which the start and end points relate).


With this I have created custom firstChild(), nextSibling(), etc methods, which will search the string and return a SubNode (with the appropriate start and end points), and a selectNodes() method which uses RegularExpressions as its search engine.


The RootNode() maintains an active record of all SubNodes that you have generated, and tracks their start and end points in response to any changes to the XML string.


If you remove a SubNode(), this automatically becomes a new RootNode().


If you insert a RootNode() into another RootNode() it becomes a new SubNode().

Accordingly it allows complete flexibility with document fragments.




Previous Message Previous Message   Next Message No Next Message


Sponsored By: