[
Lists Home |
Date Index |
Thread Index
]
----- Original Message -----
From: "Gavin Thomas Nicol" <gtn@rbii.com>
> > 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
|