1210Re: [json] Stoppable SAX-like interface for streaming input of JSON text
- Feb 7, 2009On Fri, Feb 6, 2009 at 5:33 PM, Fang Yidong <fangyidong@...> wrote:
>Yes, if your document has nesting level of about million or so. :-D
>> Maybe, but not necessarily, because this information if implicit
>> within call stack (except for having to track end markers).
>> That is, it's a recursive-descent kind of approach where you know
>> where you came from, usually without additional tracking of location.
>> Code branches based on constructs encountered.
> Yes, it's convenient. But I think it may result in a call stack based processor instead of a heap based
> one, right? The former will cause stack overflow issues in a deep nesting level. Here's a heap
So I don't think that is a practical concern.
If it happens to be, then one can construct explicit stack, similar to
how one has to do it with SAX-like interfaces.
> based processor for building object graph with SAX-like interface:Right: that builds "poor man's object binding", List/Map/primitive
structure from Json.
Most Json parsers offer that functionality via API, so it need not be
built from low-level components (json.org and others).
Code with pull API would be quite similar, although one could choose
between recursion and iteration with explicit stack.
-+ Tatu +-
- << Previous post in topic Next post in topic >>