howdy, i am learning how to read, write, change, use XML data with PHP.
as my tutorials i am using O'Reilley's Programming PHP and "the big red
book (WROX's Professional PHP4 XML)."
i have learned that there are several ways to interact with XML data.
these are called API's. the most common methods are SAX and DOM. XSL/T
and XPATH are also used for processing and displaying data.
there are benefits and disadvantages for all.
SAX - seems to be used by most, seems fastest, seems most stable... but
is basically just for parsing (no write or change).
DOM - has read, write, change functions, but is limited in file size.
it also says that it requires installation.
the funny thing is that my O'Reilly book doesn't even mention SAX or
DOM. it had an example of a script that reads XML though... and it
works... and i didn't install any modules or recompile anything. so,
how is that working? what is it using? the WROX book said that SAX
comes installed, so is my O'Reilley script using the SAX way?
my question is thus...
for those that how already been through the investigation process and
for those especially that do this type of programming, what is the best
approach. obviously, all options exist because each is best for
different circumstances.
i have decided that for the type of web design that i am doing/going to
do, a database is overkill. the work to interface with it and the
processing on the server isn't needed for smaller websites. i do want
database style ability for content however and especially am interested
in the ability XSLT can provide... allowing me to have all of my
content in XML files... dynamically generating content... whether it be
HTML, WML, PDF, printer-friendly HTML, XHTML, PDA stuff, whatever...
using stylesheets.
the stuff i learned in the O'Reilley book works like a charm and i am
excited about going forward, but... i want to be able to read, write,
and change content in my 'database' (XML files).
i see two ways that i would use XML data...
ONE - to dynamically generate web content (ported to many mediums...
web, pda, phone, whatever)... with the info in XML and using PHP and/or
XSLT and/or stylesheets and/or stuff to dynamically generate the
output. this is for big projects though. you're not going to go to this
much work for a small site/client.
TWO - for example, if i have an XML file full of the standard example
of a company directory. i'll want to read in the data to dynamically
populate files in web pages. but, i would also like to be able to write
to that file... so that i can create a web interface where you can add
new employees, edit files, etc.
regards to use #1, either SAX or DOM probably won't matter. because the
XML will most likely be keyed in by hand or via scripts that just
produce the content. the content will be just that... content. the
filler. it won't be interacted with like regular database content would.
use #2 needs to interact with the information in the XML file... not
just read it. like, for example, if a create a site that has a shopping
cart that uses an XML file to store the information. in this approach,
what would the best method be?
-wade
____________________
BYU Unix Users Group
http://uug.byu.edu/
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
