in reply to Re: Re: Re: XML::Twig - literal nodes
in thread XML::Twig - literal nodes

Picture this:

The primitive parser (Expat in your case) reads, conceptually, a character at a time and runs it through the grammar rules.

When I get the open-tag event, the code can change a bit in the thing that the parser is reading from, so that filtering is turned on. It turns itself off when it sees the end tag.

So, it requires knowledge of the exact input position of the parser, so that logically it reads one char at a time (if it buffers lines, it needs to flush & resync to the "logical" position).

So I think XML::Twig could handle it, using that method: input filters that are specified as processing input exactly up to the tag that triggered the current callback. So, if the callback changes something in the filter, it will affect everything following that tag in the source.

See what I mean?

—John

  • Comment on Re: Re: Re: Re: XML::Twig - literal nodes