Sign In/My Account | View Cart  
advertisement

Article:
 Non-Extractive Parsing for XML
Subject: Working Example
Date: 2005-03-14 03:46:48
From: Julian Turner

I independently happened upon non-extractive thinking, when my web hosting company did not provide an XML parser component.


I wrote my own parse, and mindful of the need to avoid server overheads, came up with the idea of a simple string based XML parser in Javascript, where effectively the XML is retained as a single string, and each "node" you create identifies a start and end point in the string.


I.e. the document is not parsed. What happens is that if you call say "firstChild" the method will use string functions to find the start and end of the the node, and then return a node object. So node objects are only created as you need them.


Because Javascript does not support pointers, the main processing overhead is the need to update these start and end points (if you are doing editing).


If you are doing simple reading, then the only overhead is storing the XML string in memory, which is considerably less demanding than parsing the document.


RegExp patterns are used to implement simple node searching.


See my web site www.baconbutty.com which is based on this + HTTPRequest.










Previous Message Previous Message   Next Message No Next Message


Sponsored By: