3 Jun 2004 12:33
On the fly XML parser
The attached example is an attempt for an "on the fly"
XML parser. XML files tend to get very big: the idea
is not to load the entire file into memory but to
parse it when loading the file.
The parser was modified to use prefix parsing, and the
rNode and rElement merged into a new rXML rule. We
loose the element nesting information: a stack needs
to be set up to keep track of nesting level or skip
entire blocks.
Could the prefix parser stop on defined rules, that
would avoid changing the grammar?
There is another tweak in the prefix parsing loop:
char c = file.get();
while(c != ' ' && c != '\n' && c != '\r' && c != '\t')
{
...
}
helps the parser not to stop on string parsing (e.g.
"<!--" in rComment);
is there a better way to handle this trick?
Regards,
(Continue reading)
RSS Feed