Re: [xml-dev] JITTs and DOM

From
Karl Waclawek <>
To
Date
2002-10-11T17:03:15Z
ID
<008301c27148$172a5730$9e539696@citkwaclaww2k>
Thread
Re: [xml-dev] JITTs and DOM
----- Original Message ----- 
From: "Gavin Thomas Nicol" <>


> > I am wondering why there is no API combining Push or Pull with DOM.
> > Most DOM parsers have an underlying event parser anyway.
> 
> You could use a SAX filter if the DOM builder can take SAX as input.

Well, that is what I usually do - using a SAX parser
and building an application specific object hierarchy (not really DOM).

It would be convenient, however, if the API standardized this.

Example with some Pull API (pseudo-Pascal):

...
Parser.Start;
while Parser.NextNode do
begin
  Node := Parser.Node;
  case Node.Type of
    ntElement:
    begin
      if TElement(Node).Name = 'SomeName' then
        Parser.KeepNode(Node);  // this adds the node to the tree
    end;
    ntAttribute: ...
    ntComment: ...
  end;
end;
...

Karl