[CLUE-Tech] PHP and XML Woes

Jed S. Baer thag at frii.com
Thu Jan 29 23:35:55 MST 2004


<whinge>
It's times like these that make me long for the good old days of writing
Fortran. Is there any PHP or XML documentation that's written as clearly
as the old DEC Fortran and System Services manuals?
</whinge>

OK, now that you know where I'm coming from ...

What I'm trying to do is use XML to represent information for the CLUE
website, and manipulate that data using PHP. Now, much of it is very
straightforward, but there are a few cases where I want to allow
completely free-form text, because the data is too arbitrary to try to
force into a particular structure. An example would be a block of HTML,
contained in an event listing. The event listing might, for example,
contain a hyperlink to map.

So, I figure I can put this sort of stuff in a CDATA section. I guess the
CDATA section goes inside an element. Sort of like:

  <para><![CDATA[ the <a href="foo">stuff</a> ]]></para>

In some of the material I've read, it appears that using a DTD might allow
this to be cleaner:

  <!ELEMENT para (#CDATA)>

and

  <para> the <a href="foo">stuff</a> </para>

but the PHP Expat XML parse routines don't have any indication that they
use a DTD, so even if that were valid (which I'm pretty sure it isn't), it
doesn't work. The PHP "character data" handler is for stuff like:

  <stuff>This is character data</stuff>

where there isn't any "markup".

And, in doing web searching, I don't find any code, docs, or examples for
parsing genuine CDATA. In fact, the examples which exist get in the way,
because they refer to the character information enclosed by the start/end
tags as CDATA, when in fact it's PCDATA (based on what I've gotten from
reading various things).

So, does anyone know of any good, clear, unambiguous, real-english
language documentation on PHP tools for parsing XML? And, for that matter,
the same sort for XML? I put it in these terms, because I've actually
looked at the W3C XML stuff, and AFAICT, if you aren't already thoroughly
indoctrinated in the academic hightower SGML nomenclatura, their
descriptions of how this stuff works is as useful as particle physics is
to a pastry chef.

Sorry to sound so whiny, but I've had my head pretty deep into some
seriously complex programming in my time, and I think I've never found it
so difficult to dig up usable documentation of how things work.

TIA.
jed

-- 
http://s88369986.onlinehome.us/freedomsight/

... it is poor civic hygiene to install technologies that could someday
facilitate a police state. -- Bruce Schneier



More information about the clue-tech mailing list