On Nov 1, 2007 1:21 AM, Edward Z. Yang <[EMAIL PROTECTED]> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hannes Magnusson wrote:
> > We are ditching xslt in favor of the new PHP based rendering system
> > (see the top news entry on php.net :)), called PhD, which uses 3% of
> > the time the xslt rendering takes...
>
> My apologies, that was me talking before I'd have read
> Buildsystem-proposal.rtf. Now, after having read that, and from my
> limited readings of the source code (docs, docs, where are my docs? :-),

Hey! Its not like this is a documentation project... ou, wait. oops :P


> Using XML Reader seems to be quite efficient, but though flexible (since
> we can use PHP to arbitrarily process the internals), it lacks the
> expressive pattern matching XSLT has. There is currently no well-defined
> way for a PhDFormat::format_* function to do another traversal of a
> different segment of the tree. In fact, because of XML Reader's design,
> which allows for its low memory usage, this is impossible without
> actually parsing a DOM and running XPath on it (or pregenerating it, as
> we do with indices, as I understand it). Currently, we deal with this
> issue by requiring any data to be used later to be early in the XML
> file, so that the PhDFormat class can stash it away in its $tmp member
> variable.

Correct, we read the xml twice, once to index it (picking out the ids
and descriptions for them).
We also use DOM+XPath when we need, see the Q&A handling
(phpdotnet->qandaset()).
And when we need to store some data for later we throw it into tmp variables.

Any kind of "magic generation" at the rendering stage is, imo, very
confusing and annoying, which is why the "PHP class view" is done at
the markup level, via xinclude.
But even using xslt we would still face the same problem, figuring out
if this is an inherited method or not.

> This is, however, irrelevant for the issue of duplicated class names.
> Inspecting the source:
>
> <refentry xml:id="function.xmlreader-close"
> xmlns="http://docbook.org/ns/docbook";>
>  <refnamediv>
>   <refname>XMLReader::close</refname>
>   <refpurpose>Close the XMLReader input</refpurpose>
>  </refnamediv>
>  <refsect1 role="description">
>   &reftitle.description;
>   <methodsynopsis>
>    <type>bool</type><methodname>XMLReader::close</methodname>
>    <void/>
>   </methodsynopsis> [Snip]
>
> Looking at <methodname>, it becomes clear that short of parsing the
> string (relatively simple, but remember, this is XML) there is no way of
> telling that XMLReader is the class name and close is the method name.
> There are several ways to handle this:
>
> 1. Add the parsing code to PhD, so it can split up methodname into its
> appropriate parts. :: serves as a sort of shorthand


The problem here is that in most cases we do want to print out the
classname too.
Only in the "PHP class view" we want to omit it.. how should the
renderer know when to drop it?

> 2. Split up <methodname> into a <classname> and <methodname>. This
> approach, not only embedding the information into the XML, also allows
> us to swap out :: for a more appropriate -> if necessary (especially for
> non-static functions)

Right, but classname is not allowed anywhere inside methodsynopsis.
We would need to switch over to classsynopsis, but then we wouldn't be
able to fetch the classname at all since we can only xinclude the
methodsynopsis...


-Hannes

Reply via email to