01-11-2003, 08:04 PM
I'm a complete newbie at XML, and am trying to figure out what can it do for my site as its the next big thing. So, just for the heck of it, I'm creating a review section of my own for future links to other websites from my site.
I guess it would look something like this
Now that would mean that I have to have all this information set up in xml files. I was wondering if I can avoid that, and just read from text files and then setting them up in the xml file format, and then calling them into the site. That possible? Or is this method too slow? Can someone point me in the right direction? If I had a choice of language, I'd rather use Php. I'm checking PHP.net as I type this for more information.
01-12-2003, 06:45 AM
What you have is doable in XML. I'm wondering why you'd want to do it via XML.
Don't get me wrong: I love XML. (That's why I moderate this forum.) But I sense the data you want might be better structured in a group of tables than in a tree (which is what generic XML is organized as).
Information like this might be better stored in a MySQL database you access from PHP. It would give you better interaction with the data, and allow you to modify it from a web-based interface without too much trouble. For the record, my fellow moderator Simon (aka firepages) makes a wonderful little package called phpdev for Windows users, as a testbed Apache + PHP + MySQL server for developing your own server-based scripts.
I don' t know how to use the XML parsing functions of PHP. Sorry.
If you're absolutely determined to use XML, I'd recommend you look up the RDF specification at the W3C (http://www.w3.org ). But I barely understand that myself, and a PHP+MySQL database would probably be easier for you.
01-12-2003, 02:55 PM
Yeah, I know I can do it in a database, but I'm trying to come up with an excuse to use XML/XSL but I just can't find any for my site. The link option was the closest. How have people used XML to their advantage so that its better to use the tree than a database?
01-13-2003, 02:21 AM
I've done a bit of using XML as a pseudo database. The killer advantage is environment independence.
PHP has native parsing functions which are well described in the PHP documentation (http://www.php.net/manual/en/ref.xml.php). They work well, but I find them kinda quirky - there's a few stings in there if you don't read all the documentaion and notes quite carefully ...
XSLT is much more fun ... but itself may not have the processing capabilities to provide the kind of interaction you want, so you might still have to generate some native code. That would be sufficient to provide read-only DB style functionality .. but writing back to it is much more tricky ...
.. and I can't help you there cos I don't know, but it's definitely possible with both approaches.
I think XML can useful for small db applications, with the disadvantage of speed, and the advantage of platform and process independence for your data. I favour the latter ... because it's a breath of fresh air for data sharing with other websites .. and because process is cheap :D
01-13-2003, 09:20 PM
There's always a middle ground (if you can figure out how to do it). Have the PHP generate the XML for other sites... :thumbsup:
01-14-2003, 04:17 PM
Originally posted by Alex Vincent
Have the PHP generate the XML for other sites... :thumbsup:
Nice idea :) But tricky ...
PHP's native extensions can't create XML directly, but you can create a text-file with XML-syntax data in it, and save it as .xml; there's no validation there, so you'd have to be very careful.
But any server-based XSLT processor would have the capability ... I'm sure there'll be stuff about it, out there somewhere .. possibly Sablotron's PHP extension documentation (http://www.gingerall.com/charlie/ga/xml/x_sabphp.xml) is a good place to start
12-23-2005, 06:50 PM
Are you trying to parse that information in PHP? Here is a basic tutorial on using the built in XML parsing functions of PHP.