[Zope] Thoughts on XMLishkindasorta things

Christopher G. Petrilli petrilli@amber.org
Sat, 30 Jan 1999 19:32:24 -0500


Yes I'm being vague, lest the XMLnazis breat me up again...

Anyway, so I've MOSTLY got the 'store' feature working, and here's how
I'm trying to do it...


* Create new tag 'store', used like this:

	<?ztml store var foo ?>

  Actually what comes after the store command isn't that important, it's
  a neat trick... it creates a tag object as if the user had inserted

  	<?ztml var foo ?>

  This is stuffed in the render string, but when render time comes,
  rather than putting out information for the output stream, it shoves
  the object into the register.

* Introduced the concept of a parameter entity into the parser, which
  has its own table for management, seperate (for future use! :-)

  For those unfamiliar with XML things, a parameter entity is actually
  slightly different than a regular entity (character entity)... it's
  formed thusly:

  	%ztml;

  Note the use of the '%' character, rather than the '&' character. My
  reading of the standard says that this is the correct use, not the
  regular character entity (&ztml; was the proposed one).

* Converted the HTML-style parser to re, rather than regex...

So here's how the trick works... the 'store' tag inserts the tag object
into the register rather than the rendering string.  When the parser
sees an entity (parameter entity, not character), it looks it up in the
table to see if it matches---same way the regular tag lookup works---if
it does it inserts that into the output stream... 

Now the trick is that when the constructor is called on the entity
object it doesn't do anything (right now it's just a 'pass')... the neat
stuff happens when it's called (__call__) and it executes it's render
method.  THEN it goes and grabs the current object out of the register
and renders it at that point... if it can't find anything, it doesn't do
anything.

Make sense? Or was I writing code entirely too late after too much wine?
:-)

BTW, a side effect of this is that I've been documenting the
HT_String.py, HT_HTML.py and a few other modules here and there as I
figure out how they work :-)

Chris
-- 
| Christopher Petrilli
| petrilli@amber.org