Re: [phplib] why not XML/LDAP From: Kristian Koehntopp (kris <email protected>)
Date: 08/06/01

In netuse.lists.phplib you write:
>> and they [XML and LDAP] have only weak integrity checking and
>> weak data types.

>With XML Schema, XML data values can be constrained at least as
>well as the datatypes and checks do in SQL. However, I don't
>think XML Schema addresses referential integrity.

Has anyone here on this already looked into XML Schema? I have
had only a very cursory glance, and I'd like to see some kind of
executive summary and some comparison "DTD vs. XML Schema vs.
SQL table definitions with constraints and triggers". I believe
that would greatly help to get an overview.

Also, which tools already support XML Schema?

>> But, does an application want to store its internal data in XML
>> representation?
>>
>> Certainly not.

>That seems too strong if we include applications like
>document/content management -- and why wouldn't we, on this
>forum. I've found XML markup to be very productive as a base
>representation for documents that are then rendered as XHTML.

Admittedly yes. But then, XML variants are somehow natural
native formats for document and content management systems due
to the nature of the data that is being managed. I have seen one
system that does, what you describe here:

>Representating those same documents as the join of fragments
>from a relational database, no matter how elegant the
>tree/relational mapping, sounds like a major hassle.

and "unpretty" is to mild a description for its design.

On the other hand I am using XML as a native format to write
the FAQ for de.comp.lang.php, the german language newsgroup on
the PHP language. That format is very roughly

<faq>
 ...
 <chapter>
  <keyword>...</keyword>
  <question>
    <keyword>...</keyword>
    <keyword>...</keyword>
    <answer><keyword>...</keyword>...</answer>
    <answer>...</answer>
  </question>

  <question>
    <answer>...</answer>
    <answer>...</answer>
  </question>
 </chapter>

and the content of <answer/> is some very limited and stylized
subset of XHTML plus some dedicated crossreferencing tags
(including references to other chapters, questions and answers,
but also to php function definitions and ini variables in the
manual, to amazon ASINs and similar external entities).

_But_ I would not think of querying to XML to perform a keyword
search on that. Instead I wrote an XSLT file that converts this
structure into a CSV datafile that can be imported into MySQL
and I query those SQL tables with keyword searches (I haven't
completely implemented that, so this is why you do not yet find
that feature on my site, http://www.koehntopp.de/php/).

I am using another XSLT file to create HTML from that same XML,
and I am serving that HTML as static HTML with a dynamic PHP
generated wrapper, but the regularly structured
chapter-question-answer container with keyword assignments at
every level lends itself much better to SQL tables, thank you.

I am using XML as a native format only, because it requires zero
learning curve for people willing to contribute to the FAQ and
it requires zero tools to write, as well (well, you _may_ use an
XML aware editor, if you like). Also, I am not using docbook but
some custom format because I want structure, not layout, and
because I want specialized custom internal and external
references. Using a third XSLT file, I could create docbook from
by FAQ format at any time.

>Overall, though, your argument for XML's role is well-stated and
>convincing. Thank you, Kristian, for providing it.

That was in part a preview of a session I may (or may not) hold
at the international PHP conference
(http://www.php-kongress.de/2001/index_en.php) in Frankfurt,
Germany. The complete program will be available shortly at
http://www.php-kongress.de/2001/program_en.php, including
abstracts and a timetable.

Kristian

-- 
	http://www.amazon.de/exec/obidos/wishlist/18E5SVQ5HJZXG
		"bow down before the one you serve.
		 you're going to get what you deserve."
			-- Trent Reznor (Sysadmin?)

-- Abbestellen mit Mail an: phplib-unsubscribe <email protected> Kommandoliste mit Mail an: phplib-help <email protected>