Slashdot Mirror


No Nonsense XML Web Development with PHP

Alex Moskalyuk writes "PHP and XML seems like a marriage made in heaven. Powerful manipulation functions and support on the core language level in PHP5 combined with universal extensibility of XML make it a technology of choice for quite a few Web enthusiasts and companies out there. However, anyone inspired by PHP's ease of use can probably find a good cure from insomnia when facing with XML specs. With all the DTD's, XML Schemas, XSLT and XPath queries one can easily get the impression that the world is changing on them, and perhaps sticking to hard-coded HTML with PHP statements combined with SQL statements for data retrieval would be within the zone of comfort." Read the rest of Alex's review. No Nonsense XML Web Development with PHP author Thomas Myer pages 354 publisher SitePoint rating 9/10 reviewer Alex Moskalyuk ISBN 097524020X summary XML, XSLT, XPath and DOM primer for PHP developers

Thomas Myer's No Nonsense XML Web Development with PHP is an XML primer for those who have been exposed to PHP, but are yet waiting to appreciate the elegance of PHP+XML solutions. Throughout 10 chapters and 2 appendices Myer is introducing the reader to different aspects of XML, their best-practice implementations in LAMP (where last P stands for PHP) environment, and their relevance to the real world. For the real-world example Myer decides to guide the reader through writing a custom content management system - complete with publishing/admin interface, templating/presentation layer, search engine, RSS feeds and other commonly expected features.

The book is not an introduction to PHP, but it does assume that the Web developer knows what XML is, but has never dealt with it. So the first chapter just talks about properly parsing XML with IE and Firefox, validating an XML document, differences between a well-formed and a valid XML document. Overall, it provides a very good introduction to XML for someone who has never dealt with it, and could probably be skipped by developers with XML exposure.

Chapter 2, XML in Practice, goes into nitty-gritty details of XML, and 26 pages later the reader knows how to create an XML file to display in the browser, declare proper namespaces, attach a CSS file to existing XML file and display the proper XML+CSS file (look, Ma, no <html>!) in the browser. The author earns instant geek credibility by displaying Firefox screenshots, with the exception of IE screenshot whenever IE is discussed. At the end of the chapter the author takes us through the basic XSLT.

DTD's, XSLT and writing a practical PHP app take up the next three chapters, followed by XML manipulation chapters. JavaScript enthusiasts will probably find Chapter 6 pretty useful, as it discusses manipulating XML on the client side, working with XSLT, and creating dynamic site navigation based on the XML source. Chapter 7 is what one would expect from the book that has the words PHP and XML in the title - discussion of SAX, DOM and SimpleXML parsers, examples of their implementation, discussion of proper use cases for each one of the technologies. The SimpleXML subchapter also contains a good primer on XPath - a query language that allows the developer to provide the parser with a query to navigate down the XML document.

Chapter 8 takes the reader through RDF and RSS, discusses the ways the syndication feeds are used on the Web nowadays. Since throughout all these chapters we're building a content management system, this is the right time to add the RSS headlines functionality to the site. The next chapter discusses another practical implementation of XML on the Web - XML-RPC calls between the sites and proper ways of exchanging data via XML Web services. The chapter discusses SOAP, although not a whole lot, and just mentions REST as another way to implement Web Services. As a practical exercise, the author takes readers on a tour of building an XML-RPC client, server and connecting those two together.

The last chapter talks about using XML with databases. Native XML databases are discussed, but let's face it - most of the PHP development is done with relational databases anyway. Myer talks about exporting MySQL database contents into XML with phpMyAdmin and mysqldump. The first appendix includes function reference for SAX, DOM and SimpleXML parsing in PHP, while the second one completes the CMS project by providing the rest of the necessary files.

I found the author's style very easy to follow and approachable. The code samples are succinct and to the point, there are also no generic discussions, such as "Why PHP?" The project chosen for the practical implementation is a bit boring, but at the same time quite real-world. The screenshots are clear, and code examples are nicely highlighted. The errata is provided on the book Web site. Code archive is available as a single file download as well. The book site also provides 100% money back guarantee (less shipping and handling fees) to anyone who bought the title, and didn't feel like they were getting their money's worth.

However, there are a few drawbacks that I noticed as well. With topics like XSLT and XPath broken into several chapters and discussed in smaller chunks, it's hard to use the book as a reference later on. Appendix A with PHP function reference for XML parsing hardly seems like a worthy addition, since PHP manual page on the subject contains equivalent information with more real-life examples contributed by users.

With all that, the book is quite informative, educational and useful. The author manages to tackle quite a few difficult topics in 260 pages provided to him (the count excludes preface and appendices). However, kudos to the author for writing chapters on XML without sounding boring, redundant or too academic. I would highly recommend this book to anyone interested in developing PHP-driven Web sites that provide or consume Web services, work with XML data or generate XML for others to use."

You can purchase No Nonsense XML Web Development with PHP from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

131 comments

  1. Better matched, perhaps, than Perl & XSLT by Orrin+Bloquy · · Score: 3, Insightful

    One thing I will concede to PHP is that you tend to be more likely to have XSLT engines installed on a PHP based system, whereas I had to cajole my sysadmin into getting the C-based transformation libraries installed and then locally install the dependent Perl libraries to use it on top of that. In the end the Perl/XSLT solution I created works, but it wasn't fun to install.

    --
    "Made up/misattributed quote that makes me look smart. I am on /. and I must look smart."
    1. Re:Better matched, perhaps, than Perl & XSLT by icklemichael · · Score: 4, Informative

      Any recent install of java will almost certainly have an xslt processor on it, you just have to remember the magic incantation:

      java org.apache.xalan.xslt.Process -XSL [template] -IN [file]
    2. Re:Better matched, perhaps, than Perl & XSLT by Heembo · · Score: 2, Informative

      Not only that, but most Java/J2EE developers have been XML'ing as a core part of the language for many years. This posting seems a bit off (like as in, 3 years off) to me...

      --
      Horns are really just a broken halo.
    3. Re:Better matched, perhaps, than Perl & XSLT by tiedemann · · Score: 2, Informative

      Same with the .NET framework.
      XPath, XQuery and XLST has had really nice implementations since the beginning.

    4. Re:Better matched, perhaps, than Perl & XSLT by Heembo · · Score: 1

      I agree. XML is old hat at this point. I especially love XPATH, it's the easiest way I know to address XML.

      Recently in the Ajax world I've started using Googles AXPATH library to handle ajax xml responses at the Javascript client level. Even with old machines and very complex XML, googles xpath javascript library (open source) has worked miracles for recent projects! It's part of googles http://goog-ajaxslt.sourceforge.net/ library - and the xpath piece can be ripped out and used by itself.

      --
      Horns are really just a broken halo.
    5. Re:Better matched, perhaps, than Perl & XSLT by jrumney · · Score: 1
      java org.apache.xalan.xslt.Process -XSL [template] -IN [file]

      That's xalan, which although built into java in 1.5, has been shifted under javax.xml.transform, with the publically advertised classes not including the above.

  2. Code Download by saberworks · · Score: 4, Informative

    I tried to download the code examples but the site is asking me for a special code that is printed inside the book. Bleh.

    1. Re:Code Download by twitchkat · · Score: 3, Informative

      <?php

      $f = fopen('/usr/share/dict/words');

      while ($w = readline($f))
          {
          $c = curl_init();
          curl_setopt($c, CURLOPT_URL, 'http://www.sitepoint.com/books/xml1/code.php');
          curl_setopt($c, CURLOPT_POST, 1);
          curl_setopt($c, CURLOPT_POSTFIELD, array ('word1'=>$w,
      'boughtfrom'=>'amazon',
      'country'= >'US',
      'email'=>'foo@bar.com',
      'submit'=>'Downlo ad Code Archive'));

          curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
          $r = curl_exec($c);
          curl_close($c);

          if (strstr($r, 'Code Word'))
            {
            continue;
            }

          write_to_file('result.zip', $r);
          }

      ?>

    2. Re:Code Download by richie2000 · · Score: 0

      It asked me for my email address (the same I used when I ordered the book not fine minutes ago).
      On a totally unrelated note, I wonder if the e-mail address I have in my profile still works though I have nooo idea what I could send in return to the kind spirit who would help me test it...

      --
      Money for nothing, pix for free
    3. Re:Code Download by maxume · · Score: 2, Funny

      Ah PHP, the cause of, and solution to, all of life's problems.

      with thanks to Homer, of course.

      --
      Nerd rage is the funniest rage.
  3. Can't please everyone, can you? by RobertB-DC · · Score: 4, Interesting

    From the bn.com reviews, a contrarian view:

    Michael, a web programmer, February 7, 2006,
    Almost worthless.
    Based on the title, one might presume that Myer and Marini wrote the book for people who are already familiar with PHP and XML and want to learn some advanced techniques for combining them. What he gets instead are long (relative to the book itself), superficial introductions to PHP and XML and tiny, trivial examples of their combination. Everything in the book is common sense to someone who already knows PHP and XML. What the book teaches to beginners, however, is effectively useless for its superficiality, so I'd discourage anyone, especially beginners, from reading this book, even if he receives it for free. Time also is too valuable to waste on this book. Read 'PHP and MySQL Web Development' by Luke Welling and Laura Thompson and 'XML 1.1 Bible' by Elliotte Rusty Harold. One can visit SitePoint's web site to find a list of their titles and then return to a vendor site to read product reviews. SitePoint books are generally sub-par. This book is no exception.


    Somewhere, someone at bn.com is shaking their head, wondering if this "reader reviews" thing is all that good a deal after all.

    (FWIW: I think the book looks like just what I need, with my n00b level of knowledge of PHP and XML but with hopes to put them together myself, if I can just find the right feed.)

    --
    Stressed? Me? Of course not. Stress is what a rubber band feels before it breaks, silly.
    1. Re:Can't please everyone, can you? by theskipper · · Score: 1

      "Somewhere, someone at bn.com is shaking their head, wondering if this "reader reviews" thing is all that good a deal after all."

      OTOH, but maybe the glass is half full. Personally, based on his positive mention, I'd then copy-and-paste the 'PHP and MySQL Web Development' and 'XML 1.1 Bible' books into the BN search.

      Somehow I always end up going through this process when buying a book online. YMMV.

    2. Re:Can't please everyone, can you? by RobertB-DC · · Score: 1

      OTOH, but maybe the glass is half full. Personally, based on his positive mention, I'd then copy-and-paste the 'PHP and MySQL Web Development' and 'XML 1.1 Bible' books into the BN search.

      Somehow I always end up going through this process when buying a book online. YMMV.


      I guess I was being overly cynical (I'm having that kind of day). One of my criteria for buying a product or service online is that I need to find at least one good result on a Google search for "[product_name] sucks". I learn more by reading what people don't like about a product than I do from what they like. Most of the time, the things that irritate someone else aren't a big deal to me (noisy fan? non-intuitive interface? bring it on!) and I pull the trigger on the deal.

      This seems to work for eBay sellers, too. If they haven't received any complaints, either they're a nice guy (like me, still at 100% with 85 reviews) or they've bulked up with shills. If they've scored a negative like "YOURE SHIPPING CSST IS TO HIGH F-----", I count that as a point in their favor. The one time I've gotten burned on eBay ($40 worth of never-delivered indie-release Dixie Chicks CDs) was by a 100% Positive seller with tons of feedback.

      --
      Stressed? Me? Of course not. Stress is what a rubber band feels before it breaks, silly.
    3. Re:Can't please everyone, can you? by camrdale · · Score: 1

      I think this book is a great idea, but I'll never buy it. I currently use PHP to generate HTML, and I'd like to move to XML, so it's the perfect topic for me. But books go out of date fast, and there's too many free resources on the web that are constantly being updated.

      So, does anyone know of any good links for learning about the use of PHP with XML? I know I could google for some (and I have), I was just wondering if anyone has something that they would recommend.

    4. Re:Can't please everyone, can you? by theskipper · · Score: 1

      One of my criteria for buying a product or service online is that I need to find at least one good result on a Google search for "[product_name] sucks".

      Y'know, that's one of those things that sounds obvious but really isn't. Maybe human nature is to look for the positives first since that seems the most natural path toward finding the best product quickly.

      Probably also explains the success of Ebay (of which my cynicism and intense fear of being suckered prevents me from buying anything there).

    5. Re:Can't please everyone, can you? by TheDormouse · · Score: 1
      Somewhere, someone at bn.com is shaking their head, wondering if this "reader reviews" thing is all that good a deal after all.

      What? A review says "don't buy this one book; buy these other two instead."

      Sounds like exactly what a bookstore would want.

    6. Re:Can't please everyone, can you? by iron-kurton · · Score: 1

      Try the following (it's where I am learning a great deal):

      http://www.zend.com/zend/art/parsing.php (Very useful examples)
      http://us2.php.net/manual/en/ref.xml.php (Found the above link the comments on this page)

      --
      Change is inevitable, except from a vending machine -- Robert C. Gallagher
  4. XML/XSLT is often more work than it's worth by markmcb · · Score: 4, Insightful

    I authored the site OmniNerd. When I first started writing code, I made a point of storing data either in a database or XML, translating data to XHTML with XSLT, using CSS for all style issues, and controlling everything with PHP. What I struggled with for over a year was the XML/XSLT portion of the site. I was constantly having to jump through all sorts of hoops to get things done that could easily be handled with just PHP and a database.

    This isn't intended to be me bashing XML/XSLT, but more of a warning. If you plan to use these two, ensure you fully understand them and how they will tie into your site. I've found with OmniNerd that XML/XSLT solutions are very nice for the more static or semi-static content and that using PHP to generate XHTML directly from the database is better suited for dynamic content.

    Whatever you choose to use though, good luck!

    --
    Mark A. McBride -- OmniNerd.com
    1. Re:XML/XSLT is often more work than it's worth by G)-(ostly · · Score: 5, Insightful

      XML is not for "storing data". I can't believe people still find that confusing in this day and age. XML is for describing data. It's little more than a loosely built, glorified file format. It serves no more purpose to data than tabs seperating "columns" in a text file do.

      XML is good for transferring data between systems. It is not good for storing data, which is what databases are for, or presenting data, which is what applications are for.

    2. Re:XML/XSLT is often more work than it's worth by fm6 · · Score: 3, Insightful
      That's a very good analysis. I'm a strong XML/XSLT advocate, but only because I work with the kind of documents that need them: big nasty technical manuals and guides that have a lot of complicated structure, are always be updated, and have to be delivered in multiple formats. When someone challenges by XML dogma, they always point to some project they've worked on that would have been much harder if they'd had to use XML. Most of the time (not always!) they're right, usually because the particular project is a one-shot document that will see little or no revision. Of course, that just says that XML is useless to them.

      XML is a key technology, and much underused by my profession, which still relies too much on FrameMaker, Word, and (God help us!) plain old HTML. But it's not the solution to every content management problem.

    3. Re:XML/XSLT is often more work than it's worth by markmcb · · Score: 3, Insightful

      XML is not for "storing data".

      Well, in the classroom you may be correct, but when you're looking for solutions, XML is often times a better place to store static data than a database. A perfect example is on OmniNerd, when one of our articles gets Slashdotted, or we think it's going to be, we bypass the database and create a static copy of our article in XML. It's faster since no "thought" is required to query specific data as it's all just there. The results have been that our server doesn't flinch when the massive wave of HTTP requests hit our site.

      I also use it to store data for parts of the site that remain static. Why insert my FAQ into my database if it's not structured in a dynamic manner? It's far easier for me to go edit an XML file than run a bunch of queries, and we already mentioned the removed burden from the database.

      Consider the alternative of storing it in an XHTML file. If I change the style of my site, then I have to update the XHTML file too as it's static. I can quickly translate the XML via XSLT with PHP, ASP, etc. There's no need to touch the data when I make a structural change. So given the static nature not requiring a database, the desire for easy updates, and the need to remove data from structure, I still choose XML.

      So, yes, from a purist perspective it's for describing data. But from the perspective of someone trying to run a functional and effective site, it can be useful for storing certain data as well.

      --
      Mark A. McBride -- OmniNerd.com
    4. Re:XML/XSLT is often more work than it's worth by IMarvinTPA · · Score: 3, Informative

      Agreed.
      XML is designed to be an exchange format.
      Databases are designed to hold and maintain data.
      Applications are designed to present and modify the data.

      My database talks to my application which talks in XML to talk to your application to talk to your database.

      XML/XSLT is more work than it is worth because it is forcing the squre block into the round hole with a hammer. XSLT is for converting somebody else's XML into the XML your application wants to consume.
      If you have a limited number of users of your raw data, you can just as easily talk to them and give them a simple CSV or TSV file and move on with live.

      IMarv

    5. Re:XML/XSLT is often more work than it's worth by G)-(ostly · · Score: 5, Insightful

      You're not storing the data "in XML", you're storing it on the filesystem in files that describe the data via XML. The performance benefit of the static data over the RDBMS data store is provided by the filesystem, not as a function of XML. To the contrary, your retrieval of the data is actually hindered by the XML because it increases the size of the files that must be retreived and transferred.

    6. Re:XML/XSLT is often more work than it's worth by skillet-thief · · Score: 1

      This all seems pretty smart, and goes along with something that I've been realizing more and more. Dynamic techniques should be used when the content is truly dynamic.

      I think that a lot of php + mysql sites are really just using php as a templating system, and that static pages, generated automatically every hour or day or whatever, would serve just as well.

      I can say this because I started out doing just that -- mysql/php as a templating system. Now I've moved to Perl + Template Toolkit generated static pages. And I may yet end up moving to an XML/XSLT solution instead.

      --

      Congratulations! Now we are the Evil Empire

    7. Re:XML/XSLT is often more work than it's worth by Decaff · · Score: 1

      XML is not for "storing data". I can't believe people still find that confusing in this day and age. XML is for describing data.

      Wrong. XML is a combination of metadata and data. It is an excellent way of storing hierarchical data. If XML is not for storing data, then why is the OpenDocument format XML? Is that not "storing data"?

      It's little more than a loosely built, glorified file format. It serves no more purpose to data than tabs seperating "columns" in a text file do.

      This is probably why you misunderstand what XML is for - because you misunderstand XML. It is far more than this, and it was designed with some significant goals:

      1). When data is stored in XML, it should be human readable, so as to prevent loss of legacy data through the use of binary formats.

      2). XML should be very simple to parse via software (simplicity does not imply efficiency!).

      3). XML should be easily extensible, so that you don't lose data or meaning when you have to add new types of information to a file or combine different file formats.

      4). XML should be able to store data in international formats.

      5). XML should be easy to validate in terms of format, and (optionally) easy to validate in terms of structure (e.g. DTDs, Schemas).

      Somewhat more that column separation, perhaps?

    8. Re:XML/XSLT is often more work than it's worth by Decaff · · Score: 1

      XML is designed to be an exchange format.

      No; XML was designed to be a general extensible markup for textual information. There was no intention to limit its use to data exchange.

      XML/XSLT is more work than it is worth because it is forcing the squre block into the round hole with a hammer.

      A strange analogy, as XML is general purpose. It is neither <round> or <square> it is anything. Usefully, it is validatable, so if you typed <squre> this could be checked :)

      XSLT is for converting somebody else's XML into the XML your application wants to consume.

      Or updating your legacy XML to a new format.

      If you have a limited number of users of your raw data, you can just as easily talk to them and give them a simple CSV or TSV file and move on with live.

      Until a user then comes up with the requirement for an additional column, which you then can't insert without breaking the existing format. In that case, you can't move on with life until you have updated the data handling process for those users. XML is designed to handle just this situation.

    9. Re:XML/XSLT is often more work than it's worth by G)-(ostly · · Score: 2, Interesting

      If XML is not for storing data, then why is the OpenDocument format XML?

      That defines data, it does not store it. As I noted in another response to the original poster, XML is not handling any of the storage in any way, the filesystem is handling all of those functions the same way it would if it was retrieving any other type of file. When OOo opens that file, it doesn't use the XML in any way to retrieve the data, it uses the XML as an interface between text-only representation on the disck and formatted screen representation of that file. In other words, it's a transfer medium to translate the plain-text data to an actual office document, nothing more.

      Somewhat more that (sic) column separation, perhaps?

      And a Dodge Viper is more than a Model T, but both objects still exist for the same intrinsic purpose. The fact that one is more advanced and better suited to certain purposes doesn't make them different things.

      XML has nothing to do with storing data. An XML file is not a "storage tool", and when people try to make it one, all they do is build a heirarchical DBMS, which is a system of data storage and retreival that failed at all but the most specialized applications back in the 60s when it was first attempted.

    10. Re:XML/XSLT is often more work than it's worth by G)-(ostly · · Score: 1

      A dynamic, templating system should be used where the updates to the site are so frequent that it would be unreasonable to expect that the site's maintainers would be able to keep up if they had to edit the pages every time the state of the system changed. Slashdot would be a prime example.

      However, if you are not changing data frequently, or the state of your site is not necessarily subject to the input of its users, you don't really need a database system at all, unless you're merely tapping it because it already exists for some other purpose. A site like CNN.com would be an example. It's not unreasonable to believe that the site could not be maintained by hand since they have near complete control over the changes, and the changes are not constant.

    11. Re:XML/XSLT is often more work than it's worth by Decaff · · Score: 1

      In other words, it's a transfer medium to translate the plain-text data to an actual office document, nothing more.

      Well I accept that XML in itself is not a database engine, but it is more that just a transfer medium. It is the format of the plain text data.

      XML has nothing to do with storing data. An XML file is not a "storage tool"

      You are getting two things very mixed up. Not actually being a storage mechanism does not mean that it has nothing to do with storing data.

      Would you say that a Linux Filesystem is not a storage tool? After all, the Ext3 file system (for example) is just a way of labelling information; it doesn't actually store data - the disc controller does that.

      XML is a good format in which some data can be stored. This means, obviously, that it has something to do with storing data, and is vastly more that just a column delimiter.

    12. Re:XML/XSLT is often more work than it's worth by G)-(ostly · · Score: 2, Interesting

      No, XML should not be used in relation to storing data. You can build a system which uses XML to store data, I'm not contesting that, and I already mentioned what that technology is: it's called a heirarchicial DBMS, and they've long been known to be inferior tools.

      XML's purpose is not data storage, it's data description. People try to use those descriptive properties to generate applications which use XML stored on disk to store data within the stored file, but that's a waste. It's like trying to turn a car into a boat when you could just easily go obtain a boat. Sure, you can do it, but it's inefficient, error prone, and doesn't actually have any pros associated with it in 99.999999999% of all cases.

    13. Re:XML/XSLT is often more work than it's worth by Phrogman · · Score: 1

      One approach used on a site I helped develop (although admittedly under Java, it would would work for PHP just as effectively), was to store the data for the pages in xml files which were easily edited, validated using a desktop editor such as Oxygen. Once the data was updated and uploaded to the correct location, we had an admin interface which allowed the administrator to republish the entire website as static pages. I have done the same thing from a database in the past of course, but using XML allowed us to use the validating powers of XML to double check the data entered by those who were less computer savvy. From the handful of XML files we could republish the data on multiple webpages in a variety of formats quite easily and effectively. Display was controlled via XSLT and all the code did was translate the XML/XSLT and publish the results as the static pages.

      Naturally this would not work for a dynamically changing website, but it was quite effective for one that promoted an annual conference and which only had to be updated once a year. As a final benefit, it made backing up the previous years site as an archive remarkably simple since we only needed to copy the static pages off to a new location. Since all links were relative, last years conference is easily accessed as required.

      While doing the same thing with a database interface is obviously quite possible and frequently used, I found that using the XML documents to store the data was very useful in finding inconsistencies that often plagued the database style of entering the information using a DTD and validation.

      --
      "The first time I got drunk, I got married. The second time I bought a chimpanzee, after that I stayed sober" Arian Seid
    14. Re:XML/XSLT is often more work than it's worth by Decaff · · Score: 1

      it's called a heirarchicial DBMS, and they've long been known to be inferior tools.

      Agreed.

      People try to use those descriptive properties to generate applications which use XML stored on disk to store data within the stored file, but that's a waste. It's like trying to turn a car into a boat when you could just easily go obtain a boat. Sure, you can do it, but it's inefficient, error prone, and doesn't actually have any pros associated with it in 99.999999999% of all cases.

      I still can't quite get your point. OpenDocument is XML on disk which described data within a stored file. This kind of thing is invaluable for situations like document archives or auditing information - and there are major benefits to XML as a format in itself. Also, XML is not error prone - it is designed to be easily retrievable and validatable.

    15. Re:XML/XSLT is often more work than it's worth by G)-(ostly · · Score: 1

      When talking about "storage", we're talking about certain properties and functions that relate to actually manipulating, storing, and retrieving the data. For example, a filesystem is involved in "storage" because it provides functionality for all of those things, whether moving the data into a more logical structure (manipulation), or saving (storing) or fetching (retrieving) it.

      XML doesn't intrinsically do any of these things. When people speak about "storage" in XML, they're talking about applications that use XML's descriptive ability to organize data so that it can be saved and recovered. For example, you may have an application that performs a website search by looking through XML files for a list of names. It will open the file, find the tags, and then test the stored data against the criteria, contining until it finds what it needs. This is a waste, as the task could be performed much better by a RDBMS.

      You would use this XML file in other situations, however. For example, if you are a banker and you are sending data about a new client to DHS to review, you might encapsulate the data in your XML tags so that when it is recieved by DHS, a filter can move it from the file you sent into its own systems even though the data came out of your systems in a totally incomprehensible (to DHS) format.

      Also, XML is not error prone - it is designed to be easily retrievable and validatable.

      Heirarchical, non-related systems are extremely error prone, as they provide no way to prevent duplicating data sets, removing related data sets when a key piece of the data is removed, or safely retrieving all related data sets upon request. "Tree" databases have a very, very nasty habit of becoming quickly corrupted by invalid or duplicate data.

    16. Re:XML/XSLT is often more work than it's worth by Decaff · · Score: 1

      I can begin to see where you are coming from. However, I still don't quite agree. Storage is about more than just live databases. It can be about repositories and archives. This can be an area where XML is very important, as it has been specifically designed as a format that is resistant to becoming unreadable over time, perhaps due to the software that writes a format becoming unsupported. Doing long-term archives as, say, Oracle export dumps just isn't good enough!

      On the matter of XML being error prone - that need not be the case. XML allows validation of structure and replication through the use of DTDs and Schemas. If you want to avoid such problems, you can prevent them. Also, if additional information is added that can be enforced as being through new validated namespaces.

      XML is not just any arbitrary hierarchical format.

    17. Re:XML/XSLT is often more work than it's worth by Anonymous Coward · · Score: 0

      XML has nothing to do with storing data.

      Pure nonsense. XML files, which are the only XML serialization objects you mention, are certainly a form of storage, whether you think so or not. But there are also any number of XML databases; some of them layer on top of traditional RDBMS's, and some of them them store XML natively. Berkely DB XML or eXist, for example. You access data in these storage systems using XQuery, XSL, etc. You can run such queries across multiple data sources simultaneously, and combine the results. You can stuff the results directly into an XML storage container, and then start all over again.

      Clearly you have only the most rudimentary grasp of what XML is all about, or how it works. Maybe you should work on identifying when you don't know what you're talking about, and clam up when it happens before you make yourself look foolish.

    18. Re:XML/XSLT is often more work than it's worth by jrumney · · Score: 1

      I would say using XML/XSLT was a good solution where you need multiple output formats, while using PHP to generate XHTML from the database would be best suited when XHTML is all you need. There is nothing to stop you using PHP to generate XML from the database then apply an XSLT to it if you need both dynamic data and multiple formats.

    19. Re:XML/XSLT is often more work than it's worth by Anonymous Coward · · Score: 0

      XML is good for transferring data between systems. It is not good for storing data, which is what databases are for, or presenting data, which is what applications are for.

      So why can't I get data from a database in XML with a simple SQL query?

      In other words, if I run a "SELECT * from test;", why can't I get the results in XML format, with the columns being tags, and the data inside the tags? That seems to me a very reasonable thing to do, but last time I started developing a website, I couldn't find a simple way to do this...

    20. Re:XML/XSLT is often more work than it's worth by ahaveland · · Score: 1

      gzip encoding is a Good Thing and should be used wherever possible on compressible data. XML is no exception and can benefit greatly, (unless the data it contains is uncompressible and large in comprison to the XML skeleton).

      For high volume traffic and SSL, then processing can be offloaded to an instream device such as jetnexus and let the web server do what it is best at.

    21. Re:XML/XSLT is often more work than it's worth by Anonymous Coward · · Score: 0

      The reason "people still find that confusing" is because you're explaining it entirely wrong. If you want to store semi-structured data of paragraphs, italics, hyperlinks, then store that in XML. If you're storing highly structured data then a RMDBS is suited. There's no battle here between XML and databases -- only people like you who try to say "use a database" instead of the correct answer which is a question of "what's your data?"

    22. Re:XML/XSLT is often more work than it's worth by xeno-cat · · Score: 1

      "For example, you may have an application that performs a website search by looking through XML files for a list of names. It will open the file, find the tags, and then test the stored data against the criteria, contining until it finds what it needs. This is a waste, as the task could be performed much better by a RDBMS."

      Would you please explain where the data in your example is "stored" if not in the XML file that you just plainly stated is being searched by the web application. It does not matter one wit what is better, RDBs or XML. RDBs "store" there data in files on a file system. The file system allows them to "open" these files and, guess what, _look inside them_ and interigate their contents for _all sorts of metadata_ that _describes the actual data_! If I export the data in an RDB to a comma seperated file, then that is where the data is stored there too. I could open that data with an application that understands the file format and manipulate it but I would not say that the data is stored in the application. As it happens, I could also export the data as XML and store it there, too.

      XML is a container for data. XML has markers that make the data meaningful. DTD's are what "describe" the data, or at least provide domain specific constraints. XML is no different than RDB data files that reside, lifeless, on the file system until some application that understands them gets a pointer and starts to use them.

      XML is data storage. I hope that it is now clear. It also happens to be very useful as a container in certain situations.

      Kind Regards

      --
      "A few great minds are enough to endow humanity with monstrous power, but a few great hearts are not enough to make us w
    23. Re:XML/XSLT is often more work than it's worth by baadger · · Score: 1

      XSLT is for converting somebody else's XML into the XML your application wants to consume.

      Like _your_ XML into XHTML (a XML format) that your visitor's browser (and application) wants to consume?

      Client side XLST would make this alot nicer.

    24. Re:XML/XSLT is often more work than it's worth by G)-(ostly · · Score: 1

      Would you please explain where the data in your example is "stored" if not in the XML file that you just plainly stated is being searched by the web application. It does not matter one wit what is better, RDBs or XML. RDBs "store" there data in files on a file system.

      I have explicitly stated that I am not denying that people create storage systems based on XML, I have explicitly given the common name to those types of storage systems twice. Please be sure to read the entire thread through before responding in the future.

      XML is data storage
      XML is data description, and people (wrongly) use that to build storage systems. The difference between XML and, for example, a dedicated filesystem, is that the XML was not built to organize and store data for the purpose of retreival, and the filesystem was.

    25. Re:XML/XSLT is often more work than it's worth by G)-(ostly · · Score: 1

      This can be an area where XML is very important, as it has been specifically designed as a format that is resistant to becoming unreadable over time, perhaps due to the software that writes a format becoming unsupported.

      ?

      Yes, but it's not actually a storage system, so it still has to be stored in one, so it's still going to be subject to the problems you mention.

      If you want to avoid such problems, you can prevent them.

      But you have to define that on a case-by-case basis, it's not an inherent enforcement like one finds in relational systems.

    26. Re:XML/XSLT is often more work than it's worth by Decaff · · Score: 1

      Yes, but it's not actually a storage system, so it still has to be stored in one, so it's still going to be subject to the problems you mention.

      No, it is not addressing the issues of storage systems going out of date, it is addressing the issues of data formats going out of date.

      But you have to define that on a case-by-case basis, it's not an inherent enforcement like one finds in relational systems.

      There are few inherent enforcements in relational systems - things constraints and foreign keys are optional. Also, you can't impose in a relational system the range of constraints you can impose with XML, such as ordering of data.

    27. Re:XML/XSLT is often more work than it's worth by lixlpixel · · Score: 1

      $query = 'SELECT * FROM `whatever` ORDER BY `anything` DESC';

      $result = mysql_query($query, $db);

      $out = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <items>';

      while($row = mysql_fetch_array($result,MYSQL_ASSOC))
      {
          $out .= '
          <item>';

          foreach($row as $tag=>$value)
          {
              $out .= '
              <'.$tag.'><![CDATA['.$value.']]></'.$tag.'>';
          }

          $out .= '
          </item>';

      }

      $out .= '
      </items>';

      echo $out;

      // simple but works

    28. Re:XML/XSLT is often more work than it's worth by Anonymous Coward · · Score: 0

      So why can't I get data from a database in XML with a simple SQL query?

      Why can't I fry eggs in my toaster? I suppose I *could*, but that would be rather silly, no?

      If you want to query against XML data stores, use XQuery/XSL/XPath. If you want to impose integrity constraints on your data, use any of a number of schema definition languages, like XML Schema or RELAX NG.

      XML's biggest problem is that the hype preceded the ratification and implementation of some of the ancillary standards required to use XML in cool ways. Don't let slashdot meatheads who don't know what they're talking about dissuade you from at least investigating the possibilities. There are certainly places where an RDBMS is the better tool. But although there is a certain degree of overlap in problem domain, XML was never really intended to compete head-to-head w/ RDBMS's. Sometimes you want a relational database. Sometimes you want an XML database. Sometimes you want a text file. Sometimes you want to quit IT, and sell suntan lotion on the beach. The more tools you have in your toolbox, the better craftsman you can be.

    29. Re:XML/XSLT is often more work than it's worth by skeeterbug · · Score: 1

      i dare say that you just don't understand all practical uses for xml. i'm currently working on a front end for a hardware configuration file... let's see, i'm probably storing up to a maximum of 100 pieces of information. would you recommend oracle to store that data? okay, how about postgresql (my fav, anyway)? i'd argue, xml is perfect to *store* and describe this information, which is why we chose to use it. postgresql would just be flat out overkill.

    30. Re:XML/XSLT is often more work than it's worth by slashdot.org · · Score: 1



                    <'.$tag.'><![CDATA['.$value.']]></'.$tag.'>';



      What if $value contains a ']' ?

    31. Re:XML/XSLT is often more work than it's worth by Hynee · · Score: 1

      Probably, but while people are still in love with it we should get a stream of good data handling tools. Thanks for being the guy who said the emperor has no clothes.

      --
      Damn, I already moderated this topic. Now I'll have to log in with my sock puppet to comment.
    32. Re:XML/XSLT is often more work than it's worth by G)-(ostly · · Score: 2, Interesting

      ...it is addressing the issues of data formats going out of date.

      But data formats aren't storage, they're representation.

      There are few inherent enforcements in relational systems - things constraints and foreign keys are optional
      There are many inherent enforcement in relational systems. There also happen to be many psuedo-relational system masquerading as something they're not.

      Also, you can't impose in a relational system the range of constraints you can impose with XML, such as ordering of data.

      That's not true, you can order your datasets in any way you want* when you retrieve them as long as you put them in in a meaningful way to begin with (or, if your order is totally meaningless, keyed it to an autonumber/identity attribute), they're just not stored on the physical medium in an "ordered" fashion of your choosing, which is hardly relevant because a saved XML file probably isn't either.

      * need to order chronologically? Store and inspect a creation date. Need to order alphabetically? Trivial. Need to order by byte size? No problem. There's no way that a reasonably built RDBMS can't order data, except randomly, which you can always accomplish with the presence of an identity attribute.

    33. Re:XML/XSLT is often more work than it's worth by G)-(ostly · · Score: 1

      I don't think I have to worry about feeling foolish since, at the time of your post, I had already said everything about the technologies involved that you have, minus the critical terminology errors and made up accusations, but with significantly less chest-thumping and superiority complex.

    34. Re:XML/XSLT is often more work than it's worth by woolio · · Score: 1

      True.

      I re-worked my personal website to use XML for all the page data and XSLT to render the pages into HTML. I have both static and dynamic pages. I tried to keep all formatting out of my XML files with the exceptions of things like "bold", "underline", etc.... PHP scripts generate XML which is rendered to HTML in the same way.... I was thinking that eventually, I could add the ability to export the current page as a PDF, etc...

      Well, it didn't quite turn out as well as I hoped. I had to re-implement many things in XSLT like the bold, underline, and paragraph tags [which was a pain]. Occasionally, I find in my PHP dynamic pages that I didn't properly escape/convert to entities some piece of text. Which causes the dynamic page to die before anything shows up (XML parser error). [Yes this is a design error, but the lack of integratation here causes many practical problems].

      I feel what is really needed is tighter type control in something like PHP, so that I would be incapable of concatenating unclean text with XML data...

      [Perhaps I should have built the dynamic XML files up using the DOM functions -- but this seems like a real pain.]

    35. Re:XML/XSLT is often more work than it's worth by Decaff · · Score: 1

      But data formats aren't storage, they're representation.

      But then relational database files aren't storage - they are representation. If you want to proceed down that path, storage is nothing but magnetic domains on disk.

      There are many inherent enforcement in relational systems. There also happen to be many psuedo-relational system masquerading as something they're not.

      Very true.

      That's not true, you can order your datasets in any way you want when you retrieve them as long as you put them in in a meaningful way to begin with (or, if your order is totally meaningless, keyed it to an autonumber/identity attribute), they're just not stored on the physical medium in an "ordered" fashion of your choosing, which is hardly relevant because a saved XML file probably isn't either.

      By 'stored' I mean what you get back by opening the storage medium and retrieving it. If you open a database, you don't get back things in a specific order unless you ask for it. If you open an XML file you do get things back in a specific order.

      * need to order chronologically? Store and inspect a creation date. Need to order alphabetically? Trivial. Need to order by byte size? No problem. There's no way that a reasonably built RDBMS can't order data, except randomly, which you can always accomplish with the presence of an identity attribute.

      Here is your own argument back at you! That is not storage - that is retrieval. Relational theory has no idea of intrinsic order in storage.

      So, XML can impose more constraints than relational databases, as relational stores have no idea about order, and work only in terms of sets.

    36. Re:XML/XSLT is often more work than it's worth by G)-(ostly · · Score: 1

      So, XML can impose more constraints than relational databases, as relational stores have no idea about order, and work only in terms of sets.
      First of all, it's misleading to say that RDMBSs work in terms of "sets". They work in terms of relations, and a relation can be as restricted as a single attribute and tuple pairing, or as complex as the entire set of data. Secondly, RDBMSs have no sense of "order" becuase they don't need it. There is no order that can not be arbitrarily applied on the fly via queries, or reused again and again via views. In fact, the only order that can not be inherently applied to data is "random", which can be enforced by keying the data against an autonumber or identity field (a practice which drives me crazy).

      Third, XML imposes no constraints. Relational algebra is an actual, tangible thing which, with a limited number of inputs, can be used to restrict data to ensure consistency and atomicity. XML is just whatever data you want to toss into a text file. You can build a DTD or Schema, sure, but how is that any different, really, from just building a complicated application specific to that data to manage the data for you and then tossing it into a text file without the XML?

    37. Re:XML/XSLT is often more work than it's worth by G)-(ostly · · Score: 1

      Because the database you're using doesn't support it. Investigate other vendors.

    38. Re:XML/XSLT is often more work than it's worth by G)-(ostly · · Score: 1

      XML does not store data. I defy you to present me with a chunk of XML that will actually defines some sort of executable behavior that results in me retrieving a piece of data.

      This would be opposed to you giving me a chunk of XML data, wrapped around other data, which describes the wrapped data, which is what XML does, since XML doesn't "store data". Since XML is stored data.

      You're right, there's no competition, because XML doesn't do data storage, which is what a database does in addition to doing data description.

    39. Re:XML/XSLT is often more work than it's worth by Decaff · · Score: 1

      First of all, it's misleading to say that RDMBSs work in terms of "sets". They work in terms of relations, and a relation can be as restricted as a single attribute and tuple pairing, or as complex as the entire set of data.

      Fair enough.

      Secondly, RDBMSs have no sense of "order" becuase they don't need it.

      Well, RDBMSes don't need it, because they store data that doesn't need it. Not all data fits neatly into relational form.

      Third, XML imposes no constraints.

      Not of itself, but it has the ability to.

      Relational algebra is an actual, tangible thing which, with a limited number of inputs, can be used to restrict data to ensure consistency and atomicity.

      True.

      XML is just whatever data you want to toss into a text file.

      This can apply equally to data stored in relational form. You can have a table that consists of nothing more than, say, a timestamp and big text field. To get the benefits you need to define how the data is divided into meaningful columns to get the benefit. Same with XML - unless you define the meaning and relationships of tags you don't get the benefit.

      You can build a DTD or Schema, sure, but how is that any different, really, from just building a complicated application specific to that data to manage the data for you and then tossing it into a text file without the XML?

      There is all the difference in the world. There are clearly defined and widely used standards for DTDs etc. One of the primary design considerations of XML was to avoid loss of data because applications go out of date. This is why things like DTDs are standardised. Everyone can open your XML file and be able to be sure it is valid according to the rules you have expressed in your DTD. They can even extend the format with their own namespace and be sure that they haven't broken existing uses.

      This is a huge step forward from old formats that did indeed require specific software (and specific versions of that software) to intepret a file format, and my experience is that surprisingly few developers realise it.

    40. Re:XML/XSLT is often more work than it's worth by G)-(ostly · · Score: 1

      Well, RDBMSes don't need it, because they store data that doesn't need it. Not all data fits neatly into relational form.
      Please provide an example of data that can't be cleanly set into the relational model. And, yes, most people's data needs to be ordered. I very, very rarely work with data in an unordered manner.

      Not of itself, but it has the ability to.
      So does every other application on the planet. There's nothing you couldn't write in a schema that you couldn't write in C, Perl, PHP, or anything else. The point is that there is only the ability to start from nothing and define your own restrictions, there is no actual enforcement inherent in an XML file. Relational systems, however, follow mathematical functions that guarantee certain inherent enforcement provided only that the data is properly defined and the correct arguments are given to those functions.

      In other words, the relational model is the implementation and your db design is the specification you use for your instance of that implementation. The schema is merely the specification for the implementation, and there is no actual implementation inherent in it, you still need to apply it to something else, generally an application of some sort. The relational model guarantees certain enforcements suggested by your design. The schema merely suggests enforcements and relies on some other non-standard thing to apply them (for example, a web browser).

      This can apply equally to data stored in relational form.
      If it's just tossed in with no concern for its meaning, it's not in a relational form.

      You can have a table that consists of nothing more than, say, a timestamp and big text field.
      So long as you've defined everything properly, this is a relational set of data, it's just a very small set. Now, if your big text field contains all sorts of differing data types, then you don't have a relational model set up, so it's your own fault that you don't reap the benefits of that model.

      To get the benefits you need to define how the data is divided into meaningful columns to get the benefit. Same with XML - unless you define the meaning and relationships of tags you don't get the benefit.

      But there is no benefit. You make up whatever tag you want and then toss anything you want into it. You can say that it's only numeric data, but unless you build a schema that doesn't mean anything, and building a schema is not significantly different than just programming an application to manage your data for you (plus, you still need an actual application to enforce the schema's rules anyway). Plus, the schema is merely your design model, you still aren't actually enforcing it until you apply it, in combination with your XML, to an actual application.

      One of the primary design considerations of XML was to avoid loss of data because applications go out of date.

      But, again, that's a reference to data description not data storage. GIF formats provide a description, but filesystems provide the storage for the GIF files. XML formats provide a description of the data, but you must still choose some other mechanism to manage that data, whether it be a DBMS, filesystem, or something else.

      This is a huge step forward from old formats that did indeed require specific software (and specific versions of that software) to intepret a file format, and my experience is that surprisingly few developers realise it.

      I don't really buy it. Huge data stores in archaic, convoluted formats are difficult to manage when they're in transition, yes, but I really don't buy the argument that XML is a universal solution to the problem. Even if you use XML, you still have to have both ends of the transaction agree on the meaning of the XML, and when you're talking about, for example, two different companies merging, that entails sitting down and merging the two formats via a schema, which isn't really that much different from deciding on your own data format sinc

    41. Re:XML/XSLT is often more work than it's worth by Decaff · · Score: 1

      Please provide an example of data that can't be cleanly set into the relational model.

      Irregular data, such as a polymorphic list of objects of different types. Especially data that is frequently changing (say, new subclasses of objects are added).

      Huge data stores in archaic, convoluted formats are difficult to manage when they're in transition, yes, but I really don't buy the argument that XML is a universal solution to the problem. Even if you use XML, you still have to have both ends of the transaction agree on the meaning of the XML, and when you're talking about, for example, two different companies merging, that entails sitting down and merging the two formats via a schema, which isn't really that much different from deciding on your own data format since you still have to define all the atoms.

      It is completely different from having to define your own data format, for several reasons. First, you know that there are a huge number of tools out there that can parse and process and transform your data. Secondly, you know that you can easily use information and merge without having to sit down and agree on anything. You can say 'here is my bit with my namespace' and 'here is your bit with your namespace' and just process the bits you want to without conflict. One of the main design considerations of XML was specifically to enable this sort of merging!

      If one company has data that needs to be converted into the markup of another, then there are standard ways to do describe how this should be done (XSLT).

      To re-invent all this from scratch with your own data format would be a ridiculous waste of time.

      But, again, that's a reference to data description not data storage. GIF formats provide a description, but filesystems provide the storage for the GIF files. XML formats provide a description of the data, but you must still choose some other mechanism to manage that data, whether it be a DBMS, filesystem, or something else.

      No, you are missing a fundamental point. XML is designed from the start to be human readable, and users are encouraged to use meaningful markup. The idea is that the data should be, to as large an extent as possible, self describing. It makes sense without having software. XML can make sense on paper.... and sorry, but bringing up filesystems seems wildly irrelevant to me - after all, filesystems don't store data - magnetic domains on the surface of a disk do....

      I don't deny that XML can be a useful tool at times, I just don't accept that it's nearly the breakthrough solution some people portray it as

      Having dealt with incompatible formats and formats which have changed (breaking existing uses) for decades, I have no doubt that it is indeed a breakthrough solution. I have seen different organisations XML data combined together seamlessly, and work with each other's software.

      I suppose once there are more experts in XML who have honed their XML-ninja skills to the point that they can recite the various pieces of the standards backwards

      You don't need such expertise. XML itself is a trivially simple format, and even DTD and schemas aren't that hard.

      and it certainly has no place in applications or data management as a controlling factor where people are trying to push it now.

      I think that it certainly has - it has barely started to be used to the extent where its real benefits are felt throughout the IT industry.

    42. Re:XML/XSLT is often more work than it's worth by xeno-cat · · Score: 1

      If what you are saying is that the meta-data in, say, a PostgreSQL table file, sans data, is not storage, then I agree with you. The problem is that that data alone is meaningless except to clone structure. Once you ad some data, the file is then /storing/ that data. This is true for any file. the XML spec, like the Postgres table spec is all about how to store data.

      "I have explicitly stated that I am not denying that people create storage systems based on XML"

      You have stated that XML files are not storage. You claim that storage includes the access API, which it most certainly does not.

      If you reframed your argument I may agree with parts of it but you have started with a bold and incorect claim rather than focusing on what you really mean to say. There is so much confusion around XML that I decided to hash this out because you have labored to make this point and I don't see it as correct.

      Also, I'm writing an application that stores data in XML files, which were the only storage medium that met all of the short term requirements. :^p

      Kind Regards

      --
      "A few great minds are enough to endow humanity with monstrous power, but a few great hearts are not enough to make us w
    43. Re:XML/XSLT is often more work than it's worth by IMarvinTPA · · Score: 1

      Until a user then comes up with the requirement for an additional column, which you then can't insert without breaking the existing format. In that case, you can't move on with life until you have updated the data handling process for those users. XML is designed to handle just this situation.

      Then you weren't using column names on the first line and their application wasn't mapping them and ignoring the ones they didn't need. Why should order be important? Why should quantity be important?

      IMarv

    44. Re:XML/XSLT is often more work than it's worth by Anonymous Coward · · Score: 0

      Not only do you not understand XML, but you're a semantic nitwit to boot. Foolish all around.

  5. Re:wut by Danse · · Score: 2, Insightful

    XML stands for Xtremely Media-hyped Language and PHP stands for Perl-Hater's Platform. They are both very overused and should be ignored from this point on. Oh crap. I guess I get a free downmod for going against Slashdot culture. Oh well.

    No, you should get the downmod for posting a moronic comment that contains flamebait only with no facts or even anecdotes to back it up. You rightly deserve at least a -3 for such a comment.

    --
    It's not enough to bash in heads, you've got to bash in minds. - Captain Hammer
  6. Malice by Savage-Rabbit · · Score: 4, Funny

    XML stands for Xtremely Media-hyped Language and PHP stands for Perl-Hater's Platform. They are both very overused and should be ignored from this point on. Oh crap. I guess I get a free downmod for going against Slashdot culture. Oh well.

    Dude, calm down! Hating Perl is not something developers do out of malice. It's a bit more like the obvious conclusion a child draws about fire after getting burned for the first time. Of course there are also some people, like you for example, who enjoy pain....

    --
    Only to idiots, are orders laws.
    -- Henning von Tresckow
    1. Re:Malice by AnonymousPrick · · Score: 1
      Of course there are also some people, like you for example, who enjoy pain....

      That explains all of those Perl books in that S&M shop I,err, accidently walk in to every other day.

      --
      Saturday is April 1. Slashdot will be shut down. Sorry for the inconvenience.
  7. Re:wut by tomstdenis · · Score: 1

    I agree. XML is no more than a text file with key/value pairs in some form of organization.

    I'm not saying XML isn't useful I'm saying it's not that impressive as a "technology". It falls under say the Dewey Decimal system in terms of excessive usefulness to society.

    PHP on the other hand ain't bad. It's a bit simpler than Perl and IMHO meant to be a bit more lightweight. In the grand theme of things there is no reason why you could SSI perl script [hint: I did it with a CGI script that would parse my own special brew of perl/html].

    Tom

    --
    Someday, I'll have a real sig.
  8. A compromise? by MasterC · · Score: 4, Insightful
    Since I started using PHP's DOM functions, I haven't written a lick of hard coded HTML except for templates that I import into DOM. I create template tags within the template as hook points so on loading the template into DOM I can cache a list of all these template hooks (and remove them so the template is back to valid HTML) and then I can inject my dynamic content directly into where the hooks are.

    Some quick advantages:
    • You don't have to worry about closing your tags, just assigning parents
    • You can modify your tree at any point in execution (such as style changes, removing sections of the page based on user input, etc.)
    • Outputting HTML or XHTML doesn't change your DOM tree
    • You can more easily write code with more separation between functionality (model) and interface (view)
    • If an error occurs then you don't have to worry about the "headers already sent" issue
    • You can easily create DOM manipulation libraries to do a lot of the tedious tasks for you (element creation, attribute population, etc.)

    So even if you don't want to get into XML, XSLT, etc. then using the DOM for page generation is a much better solution than the traditional mixing HTML into PHP into files. The only qualifier to that I can think of is very small sites and when you don't have said libraries and such built up.

    When else would hard coding HTML be preferred? I'm drawing a complete blank.
    --
    :wq
    1. Re:A compromise? by Bogtha · · Score: 5, Insightful

      When else would hard coding HTML be preferred?

      The downside to using the DOM as you describe is that you need to generate the whole document before you start sending it. For example, imagine if Slashdot used your approach - on a page with hundreds of comments, you'd have to wait for every last comment to be added to the DOM before you even started to send the headline to the user.

      --
      Bogtha Bogtha Bogtha
    2. Re:A compromise? by Roofus · · Score: 1

      What you've written intrigues me. I've never heard of this before, and now I must do some research! Anybody else have experience with this method and wish to share?

    3. Re:A compromise? by Doctor+Memory · · Score: 1

      Uh, kinda. I wrote a set of DOM classes in PHP about four-five years back. They were handy at the time, because my goofball team leader decided midway through the project to process all the HTML as XHTML, but didn't bother to actually tell us this. So then we had to go through all our stuff and rewrite it to be conforming. The DOM classes worked, but they were more cumbersome to use, and took more time to generate the page. I haven't used the PHP5 DOM classes, presumably they're (much) better than the stuff I hacked together. I'd still question the amount of memory they use, though: you've got to construct the entire page in memory, even if it's mostly static and all you're doing is putting the current time and date in the header.

      --
      Just junk food for thought...
    4. Re:A compromise? by Anonymous Coward · · Score: 1, Insightful

      You can modify your tree at any point in execution (such as style changes, removing sections of the page based on user input, etc.)

      This is not good from a programming point of view, OK the presentation and business logic are kind of seperated, but you seem to be encouraging the business logic to modify the template... This is very bad design.

      What if you need to output a non-XML format like CSV or PDF? XSLT is dead slow and shouldnt be used for live transformation (IMHO)

    5. Re:A compromise? by usidoesit · · Score: 1

      What's "hard" about HTML? Can't expect to be able to exchange a DOM with a page designer. Assimilating the HTML into script code, programmer becomes a rate limiter, a bottleneck. XML/XSLT won't work for the same reason. On the contrary, maintenance programmers ask that we please use page templaters such as smarty, freemarker, the one's built into Django and RoR.

  9. PHP is a tool of the homosexual interent agenda by Anonymous Coward · · Score: 1, Funny

    Perl is developed by a good Christian man whom would never engage in sexual relations with another man. Perl should always be chosen over PHP.

    Praise Jesus!

  10. With a title like that... by Anonymous Coward · · Score: 0

    ...this topic should be from the 'Oxymoron' department.

  11. Re:wut by Anonymous Coward · · Score: 0

    MY GOD>>>

    I so want to rectally explore you now more than ever!!!

    PLZ SECKS?

  12. Re:wut by shobadobs · · Score: 1

    At least a -3? +5 is greater than -3, right?

  13. Re:wut by demon411 · · Score: 2, Informative
    I agree. XML is no more than a text file with key/value pairs in some form of organization.

    That's a common misconception of what XML is. XML typically refers to XML and related technologies

    1. DTD - Document Type Definitions
    2. XML Schema
    3. XSL/XSLT - Extensible Stylesheet Language, XSL Transforms
    4. Xpath - XML Path Language
    5. XHTML - XML Version of HTML
    6. XQL - XML Query Language
    7. XSP - XML Server Pages
    8. Others
  14. Re:wut by Anonymous Coward · · Score: 3, Insightful
    XML is absolutely not all it's hyped up to be.

    That said, as any Lisp programmer will tell you, tree-structured data is a Good Thing(TM). There's a reason why reading in input like:
    Mar 15 12:32:31 localhost dhclient: DHCPREQUEST on eth0 to 192.168.5.5 port 67
    is complicated and fragile, whereas reading in input like:
    (logentry (date (month Mar) (day 15) (time 12:32:31)) (host localhost) (sender dhclient) (message "DHCPREQUEST on eth0 to 192.168.5.5 port 67"))
    is so trivial that, well, I just typed this into DrScheme:
    (define logdata (read))
    and copy-pasted the second one into the input box, and DrScheme understood it perfectly.

    Regexps are basically a hack to deal with data, like the first log file (which is what it actually looks like on my system), where the structure has been compressed/eliminated. In a perfect world, everything would be tree-structured, and none of those hacks would be necessary.

    But wait... that's XML!
    <logentry><date><month>Mar</month> <day>15</day> <time>12:32:31</time></date> <host>localhost</host> <sender>dhclient</sender> <message>"DHCPREQUEST on eth0 to 192.168.5.5 port 67"</message></logentry>
    It's harder to read than the parenthetical version, and slightly harder to parse (especially if there are attributes inside the XML tags), but the two are basically equivalent.

    In Scheme, at least, you can build a generic XML-to-s-expression parser that will allow you to deal with any XML data that comes at you as easily as if it were parenthetical. And by generic, I mean that it can deal with any (well-formed) XML data ever. By contrast, regexps are fragile by definition. Even splitting along whitespace isn't always safe.

    As far as PHP goes, I couldn't care less... it's both slower and less flexible than Scheme. What a combo! (Of course, Perl is too... ;)
  15. Ummm... by temojen · · Score: 1

    It was probably the same library. libSablot is used by most of the languages that support XSLT on Linux/BSD.

  16. MOD parent UP Re:Save yourself $14.78 by Anonymous Coward · · Score: 0

    Wow a savings of $15 if you buy it at Amazon! How the hell can B&N compete?

    1. Re:MOD parent UP Re:Save yourself $14.78 by Anonymous Coward · · Score: 0

      Nice job replying to yourself, link whore.

  17. Re:wut by tomstdenis · · Score: 1

    It's still just key/value pairs. What they MEAN is a totally different thing.

    It's overly generic and the problem people like me and the OP have with it is that PHBs pick up on it and mandate the next project must have XML support even if they're not a web server or such.

    Just like how many people have blackberries that don't need them or any of the other hip bullshit out there. It's just catchy to say "XML this" XML that in conversation. If you meant XHTML say fucking XHTML.

    I don't call object files "C programming files" just because a compiler can turn C into object files. Why call XHTML "xml" because you use te XML syntax to produce it?

    Put it this way, [for instance], databases have been doing quite well for the last 20 to 30 years. Now they all simply MUST have XML technology in them. Can you honestly tell me XML support makes Databases more efficient?

    Tom

    --
    Someday, I'll have a real sig.
  18. Present in PHP5 and PEAR for PHP4..but where else? by Noksagt · · Score: 1

    The book uses PHP5's built-in support for XML. PHP4 can have similar support through PEAR. But what should those of us who release PHP apps targetted for use by people who might still be on PHP4 hosts with no PEAR use? I've used the ActiveLink PHP XML package with good results for creating XML, but it doesn't yet have any support for XSLT and XPath. Are there any minimal packages which can supply this without having to rely on PEAR or PHP5?

  19. Re:wut by Cereal+Box · · Score: 3, Informative

    The beauty of XML is that the format is simple and there is a huge stack of technologies that build on it. If you store some data in an XML format, you instantly have the ability to transform you data into any number of formats (via arbitrarily-complex XSL transforms), perform automatic validation (via XML schema or a DTD), perform arbitrarily-complex queries on your data (via XPath/XQuery), automatically include other resources (XInclude), etc. Thanks to namespace support, you can aggregate multiple XML data formats into a single document -- an example of which is XHTML, which allows a single web page to include things like mathematical annotations (MathML), vector graphics (SVG), multimedia (SMIL), complicated input forms (XForms), and so on. Like so many other people, you just see XML as a substitute for comma separated value files, and don't realize the rich set of complicated functionality that's available to you "for free" just by storing your data in an XML format.

    And BTW, XML is a tree format, not strictly key/value. And when you parse an XML file, you're never having to do direct text manipulation (which is error-prone). You're either receiving the information stored in the XML file as a series of events (SAX) or you're manipulating it via an object model (DOM).

  20. Re:wut by Danse · · Score: 1

    At least a -3? +5 is greater than -3, right?

    I suppose I was speaking negatively rather than mathematically :)

    --
    It's not enough to bash in heads, you've got to bash in minds. - Captain Hammer
  21. Re:Present in PHP5 and PEAR for PHP4..but where el by v3xt0r · · Score: 0

    uhh, you can include the PEAR modules within the codebase of your application, so PHP4 users don't have to already have pear installed on their server.

    --
    the only permanence in existence, is the impermanence of existence.
  22. Match made in heaven? by podperson · · Score: 1

    When PHP has robust Unicode support ... maybe.

    1. Re:Match made in heaven? by codergeek42 · · Score: 2, Informative

      You want mbstring which supports, among other things, the UTF-8 incarnation of the Unicode standard.

  23. Nasty stuff dude. by Anonymous Coward · · Score: 0

    If you just want a (x)html template engine, use clearsilver. XSLT is for transforming some else's XML you don't like into your XML you do like. Its awkward and painful for html templating.

  24. Re:wut by Bogtha · · Score: 3, Informative

    I think the parenthetical version and the XML version are about equal in terms of readability once you remember that any decent editor will have syntax highlighting to emphasise the text over the tags and that both versions will typically be split over multiple lines. Linebreaks don't really aid readability when you have short ending delimiters, but they do when you have longer ending delimiters.

    The idea that XML is just a reinvention of s-expressions is quite popular, but this article does a decent job of explaining how they differ.

    --
    Bogtha Bogtha Bogtha
  25. Re:wut by Anonymous Coward · · Score: 0

    XML as a technology isn't that big of a deal, but then look at what it aims to do-- send simple data.

    However, XML as a standard is incredibly important. It's got crazy extensibility, due mostly to its simplicity. It's incredibly fast to learn and human readable. Most most important, lots of different people with different setups using different protocols can send data back and forth. Were there equally-qualified technologies to do this before XML? Of course. Did nearly everyone in the world use them?

    Well, now after throwing all that out there, I reread your post and realized this is exactly what you said. So kindly disregard any contrary tone this post might have had and replace with an agreeing tone.

  26. It's not just key/value pairs. by jkeegan · · Score: 3, Informative

    No, it's not just key/value pairs. It's hierarchical. The hierarchy itself contains data - where things are located. You can't express rich hierachical data easily in a flat key/value layout.

    In an XML file, I can throw in extra attributes or elements that won't be read by an old version of an app that wasn't looking for them. In a simple comma-separated-values layout, if I add something to the format, it's completely incompatible with previous versions.

    The most complicated tools you have for comma-separated values are along the lines of cut and sed. When you have an XML document, you can convert it to *any* other XML format with a simple XSLT stylesheet (or, for that matter, into non-XML formats). SQL-Select-like statements can be represented with XPath, letting you select various fields of nodes which contain a certain attribute, act on the a certain way, etc.

    Any anyway, would you look at an HTML document and say "it's just key-value pairs"? No! The order of elements, the hierarchy of data, etc, all makes up the page as a whole. HTML was an application of SGML, which XML was derived from.. Use XHTML if that last bit confuses you - it's not key/value pairs.

    People have thrown the buzzwords at you because they're either really impressed with the technology, or because they're the kind of people that like buzzwords. Ignore the latter group of people, and try to focus on why those of us in the first group are singing its praises.

    --

    ..Jeff Keegan
    seven syllables explain TiVo: kee gan dot org slash ti vo
    1. Re:It's not just key/value pairs. by boa13 · · Score: 1

      When you have an XML document, you can convert it to *any* other XML format with a simple XSLT stylesheet

      Somehow, I feel the word simple is inappropriate here. XSLT style sheets are hairy beasts, powerful, but tough to master.

    2. Re:It's not just key/value pairs. by jkeegan · · Score: 1

      ..but they're data - they can be changed without recompiling code..

      XSLT's syntax may be daunting for some, but it's extremely powerful and lets you do transformations far easier than building custom parsing code to output the same results. More importantly, if the output needs to be tweaked a bit (by either a primary developer, or even an end user wanting to change layout/presentation, etc), then it's far easier to modify an existing XSLT stylesheet, in most cases.

      Once you've written enough XSLT stylesheets, trust me, you simplify that part of the equation in your mind to "that's just a stylesheet transform" - it's a clearly solvable problem, and knowing that, you usually then focus on other more important architectural issues of your project, and leave the stylesheet writing for later (or churn it out quick ahead of time).

      --

      ..Jeff Keegan
      seven syllables explain TiVo: kee gan dot org slash ti vo
  27. An approach used on a site I recently built: by temojen · · Score: 2, Interesting

    The way you've described it, your site still has to run a script for each request. Here's an approach I've used:

    Semi-static data (faq, articles, etc) is stored in xml files. Site templates are PHP. Scripts and styles are handled in external files.

    There's a directory /view/articles that has HTML versions of the articles; it is writeable by the webserver, but .htaccess rules to reject any requests but *.html . When a change is made to the site layout or newsbar, all the contents of /view/articles are deleted. If a change is made to just one article, only that article's html is deleted.

    On 404, the errorDocument is a php script which:

    1. Verifies presence of the article XML file (returns a real 404 page if not)
    2. Turns on Output buffering
    3. Generates the page using the template, news file, article XML, etc
    4. Saves the contents of the output buffer to /view/articles
    5. gzips the output buffer and saves that in /view/articles
    6. Sends the contents of the output buffer to the client.

    Thus the XML/XSLT stuff only happens when changes are made and apache can just send the file

    I'm working on adding customer-specfic elements to each page. This is via Javascript+Cookies+AJAX so it doesn't need each page to be regenerated for each user. The few pages that are customer-specific but have few static parts are just plain-old PHP that includes the site template file.

    1. Re:An approach used on a site I recently built: by Bogtha · · Score: 1

      For easier googling, this technique has been called "funky caching" by some people.

      --
      Bogtha Bogtha Bogtha
    2. Re:An approach used on a site I recently built: by temojen · · Score: 1

      Never seen that term before, but it does help the search. Thanks.

    3. Re:An approach used on a site I recently built: by baadger · · Score: 1

      If you are using a dynamic/script based 404 handler to do 'funky caching' make sure you return a proper '200 OK' HTTP response header before you return any html. Most web browsers are configured to display the actual 404 response from the server rather than a browser defined 'friendly' 404, but search engines will ignore the page (and the W3C validator will return an error which is how I noticed my similar setup was returning 404).

      The 404 method will also make a slight uncleanliness in your server logs.

      An alternative is to do content negotiation with MultiViews and force your scripts to be 1) extensionless and 2) accept PATH_INFO making it appear they are directories.

    4. Re:An approach used on a site I recently built: by temojen · · Score: 1

      Yup, I do that. Thanks for pointing it out for others though.

  28. MOD Parent SPAM by Anonymous Coward · · Score: 0

    Sorry... I commented and reversed my earlier moderation.

  29. Re:Present in PHP5 and PEAR for PHP4..but where el by simeonbeta2 · · Score: 1

    One nice thing about PEAR is that it's just a collection of .php files. My handrolled CMS has a few unusual PEAR requirements so I never bother trying to use a shared hosting setup's PEAR environment. I just create a directory in the documentroot and upload the /pear/PEAR directory from my box at home. Set the include path (via php.ini, .htaccess, or least preferably in .php file itself) and all the PEAR includes work...

  30. You don't order nonsense, honey--it just comes by Arrgh · · Score: 1

    The title of this book is disingenuous! XML and PHP each come with a huge helping of nonsense that you can't get rid of. Together, they're... *shudder*

  31. Re:Present in PHP5 and PEAR for PHP4..but where el by Noksagt · · Score: 1

    Thanks. I suppose I should have elaborated that I wanted something that was (if possible) (1)lighter weight and (2)compatible with both PHP4 and PHP5. Last time I checked, there were reported problems using the relevant PEAR modules with PHP5. Do people really have to have a conditional based on the PHP version number to get it to work correctly?

  32. Re:wut by temojen · · Score: 1
    As far as PHP goes, I couldn't care less... it's both slower and less flexible than Scheme. What a combo! (Of course, Perl is too... ;)

    It's also imperative, which makes it a lot easier for many people to use than a functional language like Scheme.

  33. XML Presentations from Christian Stocker by Anonymous Coward · · Score: 0

    He contributes to PHP's DOM stuff and uses XML alot in Bitflux CMS. Has done a number of talks on XML in PHP 5+ here: http://www.bitflux.ch/publikationen/vortraege.html - pay special attention to http://php5.bitflux.org/xmlonspeed/ and http://php5.bitflux.org/xmloncrack/

  34. It's getting boring... by KZigurs · · Score: 1, Insightful

    Reccomended headlines for next PHP fanboys posts:
    - PHP saves granny from death
    - How to build nuclear reactor using PHP and components from radioshack
    - Reliable extraterrestial exploration using php.net functions reference comments
    - PHP programmer cured from cancer, aids and herpes (aciquired while trying to understand any basic computer science topic)...
    - PHP Saves! Better than Jesus!
    - PHP - a quick guide to shopping.

    C'mon nerds - trying to manipulate XML with common PHP functions is like trying to hang a picture on your wall using McDonalds fries, average sized elephant and twenty years old issue of playboy magazine. Ok, I have no problems to use PHP for what it's intented - quick, dirty and unmaintainable html generators occasionally attempting to simulate functionality of even the most basic OO languages, but please - everything has its limits.

    P.S. I occasionally do XML for living. And XSLs are simple. :P

    1. Re:It's getting boring... by Anonymous Coward · · Score: 0

      NEWS. You are an ignorant idiot.

    2. Re:It's getting boring... by PHPfanboy · · Score: 1

      Chill Winston, I only chose this name as Anonymous Howard was taken.

      --
      29 mpg. YMMV.
    3. Re:It's getting boring... by Anonymous Coward · · Score: 0

      occasionally attempting to simulate functionality of even the most basic OO languages

      Prove OOP is better with *real* examples, not shapes, animals, and device driver examples. OOP is so 90's, perfect for Dilbertian buzzword lovers. (Sorry, but I had to rant.)

  35. XML Web Services with PHP? by Anonymous Coward · · Score: 0

    Currently I'm wanting something where clients send standard HTTP GET request and then my scripts respond in XML. I'm not sure if this is considered a web service or not (because it doesn't have SOAP, WSDL and the underlying architecture of most web service). Basically its a hack. A hack that is meant to save LOTS of bandwidth. The problem space is very narrow and the clients perusing the service will be aware of the structure ahead of time. I don't -need- the overhead of a real 'true' web service.

    The kicker? I need it to scale. I'm not looking to deploy it to millions of people, but ideally it could handle that if I continue to grow and just throw hardware at it.

    What do(es) the script(s) do? The majority is simple database queries and updates. Pulling and updating data. I will manage to work in some authentication scheme, too. There won't really be any floating point or otherwise.

    Basically I just need to handle lots of requests to the scripts and the database. I realize that means I need some heavy duty database systems on the backend. We're primarily concerned with the speed and handling of multiple clients. We're thinking of an open source database like MySQL or PostgreSQL. If need be, we will look at Oracle. I'm not the database guy so I don't decide on this.

    We're looking for a lightweight solution that can SCALE easily given the hardware and bandwidth. We don't want to do any rewrites once we get going with the project (yes, its often inevitable, but ideally we could write once and focus on maintenance once it goes live). In fact, we probably won't have enough time to rewrite if we wanted to once the ball gets rolling--we'll be focused on other tasks.

    However the question still remains for the frontend scripts. What can handle a ton of requests in a lean manner? Is PHP+XML the right solution for this? I'd love to hear some feedback for people who have done this.

    1. Re:XML Web Services with PHP? by Anonymous Coward · · Score: 0

      You could write a custom solution in something really lowlevel like C. If the project is simple enough, I might consider doing that. Maximize the power of the machinery.

      Though I'm not sure how you could scale with C. I'm not sure of any existing libraries that let you do that (throw more hardware as you say).

      Many large websites write their system in C/C++ though. Just a thought ;)

    2. Re:XML Web Services with PHP? by Bogtha · · Score: 1

      Currently I'm wanting something where clients send standard HTTP GET request and then my scripts respond in XML. I'm not sure if this is considered a web service or not

      "Web services" is just a buzzword. There's no specific API you need to use. Your use would be called "REST" or "POX" by many web services people, so long as you use the right HTTP verbs (e.g. use DELETE not GET to delete things).

      What can handle a ton of requests in a lean manner? Is PHP+XML the right solution for this?

      You aren't going to get significantly leaner than PHP if all you are doing is outputting XML. As for the choice of XML over JSON, CSV, YAML, etc, it really depends on what's going to be consuming your data. XML isn't the only solution, but it's probably the best supported and has the most mindshare.

      --
      Bogtha Bogtha Bogtha
  36. XML data and HTML middleware by leighklotz · · Score: 2, Interesting

    A lot of the middleware that converts data to HTML and back can go away when you use the right XML tools. XSLT does a good job of presenting static pages, and it can be fast if you cache the results as well.

    But for dynamic pages (and forms) XML to XSLT to HTML leaves some big gaps:

    1. The hierarchical XML data gets flattened out into name/value pairs in HTML form fields.
    2. For the return trip HTML->?->XML, XSLT doesn't work; you can't run the transform backwards.
    3. For dynamic pages, you're left with JavaScript or the dreaded "postback."

    These are some of the reasons we updated the W3C HTML forms module to take account of XML data directly.

    How does it fix the above problems?

    1. The hierarchical XML data your PHP or other server-side code outputs is transmitted directly to the web browser, where it remains while the user futzes with only the nodes that the form specifies. The middleware that converts the XML data to web browser data is just printing the XML.
    2. When the form results are submitted, they come back directly in XML, so there's no need to pick apart the name=value pairs and try to put them back into your data. The browser just posts the XML directly back as XML to your PHP or servlet.
    3. For forms, as the data changes, the UI changes with it. If a node disappears, or appears, or if a value changes, entire sections of UI can appear and disapear just by listing a dependency on that data. And if you want dynamic pages, you can use the background submission feature to retrieve instance data asynchronously, and the presentation changes automatically.

    Nice work if you can get it, you say? Well, as everyone knows Microsoft hasn't yet implemented XForms. (Heck, they haven't even implemented CSS, though we hear they do have it as a goal now.)

    So what can you do today:

    1. Use Mozilla or FireFox XForms 0.4. It's a one-click install download from the Mozilla website. Yes, it's beta. Yes it has bugs. Yes, IBM and others are fixing them. But it's open source.
    2. Use FormFaces for most modern browsers (Firefox, IE, Safari, Opera) FormFaces is a cool JavaScript/AJAX application that you import into your web page with a one-line include, and it does everything described above. If you need cross-browser support right now, want dynamic AJAX forms, and want to interface to XML, this is your best bet, if you can tolerate a JavaScript program in your browser (i.e., it's done using AJAX). It's available under GPL and commercial licenses.
    3. Use Chiba for backend processing Chiba is an open source Java-based back-end that converts your XHTML+XForms page into either an AJAX page or a static HTML page (good for Sec 503 compliance). Chiba is a great choice for applications that have a Java back end, as it puts less load on the browser than the large JavaScript engine of FormFaces, but I put it below FormFaces here because of the emphasis on PHP. (But, about half of Chiba is an XSLT transformation so a PHP port is possible.)
    4. Use Formsplayer as an IE plugin FormsPlayer is a deluxe XForms processor plug-in for intranet applications using Internet Explorer, and has lots of other features as well, such as sidebar support.

    Here's a quick example:

    Let's suppose you have a book list you want to view, avaialble at http://example.com/books/list.

    <books>
    <book>
    <title>No Nonsense XML Web Development with PHP</title>
    <author>Thomas Myer</author>
    <book>
    ...
    <books>

    If you want to display this data

  37. This book is useless... by snxabot · · Score: 1

    The book is 99% simpleXML, a useless bloated library extension of php5, tutorial. there is mention of sax and dom but very very brief, you can easily find better references at php.net and they are the real world tools for php/xml.

    I was disappointed to find that the author barely used php5 dom functions to support the CMS (if you can call it that) that you are being tutored along because that is definitely one of php5's strong points. i was looking for a book with function references and some code examples, they were there, however, only for the simpleXML class.

    in reality if you wanna build a php/xml cms, you're going to need to use php4.4+ and either write or use one of the many classes out there for actually parsing/writing xml.

  38. XML strawmen by handslikesnakes · · Score: 1
    Yep, and if you did it in YAML it would be even more readable:
    -
      date: 2005-03-15T12:32:31Z
      host: localhost
      sender: dhclient
      message: "DHCPREQUEST on eth0 to 192.168.5.5 port 67"
    And parseable with existing libraries to native datatypes in more languages than lisp and scheme.

    This is exactly what XML wasn't designed for. XML is shit for flat data like this.

    XML is good at representing documents. On XML's turf - well, all the lisp representations of HTML that I've seen are confusing and ugly.
  39. Match made in heaven by dracvl · · Score: 2, Funny
    "PHP and XML seems like a marriage made in heaven."

    Is that another way of saying that they deserve each other? *ducks*

  40. Re:Present in PHP5 and PEAR for PHP4..but where el by v3xt0r · · Score: 0

    I use a lot of PEAR Modules between both versions with no problem.

    For instance, the XML_Parser, XML_RSS, Mail, and Mail_Imap all work fine for me in either version 4 or 5.

    --
    the only permanence in existence, is the impermanence of existence.
  41. Joy and Sorrow by Tom · · Score: 4, Insightful

    I can't imagine two languages less suited for mixing than PHP and XML.

    PHP is losely typed, full of hacks (excellent hacks that make coding easier) and is great exactly because it allows the coder to be pretty careless and have the language look out for him as far as possible.

    XML, on the other hand, is strict and harsh on the coder. Forgot to close a tag? Wrong character somewhere? Not got the tag order correct? Sorry, your entire tree fails parsing.

    They just don't mix well, and it shows everywhere. I'm currently coding a PHP app using XML-RPC, and gosh is it convoluted. You've gotta cast practically everything into the special XML-RPC values and back out again. You'd expect the libraries to have functions doing that for you, but you'd be mistaken. On the average line stuffing together an XML-RPC call, the whole "new XML_RPC_VALUE" stuff takes up twice the space of the actual variables.

    Doesn't mix well. Sorry, I like PHP a lot and XML is an excellent thing. But they just don't mix well.

    --
    Assorted stuff I do sometimes: Lemuria.org
    1. Re:Joy and Sorrow by 1110110001 · · Score: 1

      Seems more like a problem of your XMLRPC lib. Except date everything can be written in native PHP types and the lib should use that information to construct the request or response. One example can be found in the XMLRPC client in the new Zend Framework. I've done it myself and it's really not that hard.

      One example of PHP and XML working together quite well is the Flux CMS made by Bitflux (chregu from Bitflux worked on the new XML libs in PHP5).

  42. Re:wut by Anonymous Coward · · Score: 0

    You can write (relatively) imperatively in Common Lisp. In fact, Common Lisp was the first standardized object-oriented language.

    I think the bigger issue is that syntax-less languages are hard for some people to wrap their minds around... and also other languages have adopted so many features of Lisp that the differences are less obvious than they were before. Python, for example, offers first-class functions, dynamic typing, garbage collection (of a kind), etc. And the standard library of Python makes it much easier to use for the kind of quick-and-dirty stuff that scripting langauges are famous for.

    I should try writing a Python-like language with Scheme macros. I bet it would be faster than Python is now...

  43. So You Want To Learn PHP5 and XML... by skeeterbug · · Score: 1

    please visit here...

    http://www.sitepoint.com/forums/showthread.php?t=3 54632

    if you know some cool php5 / DOM / XML / XPath / XQuery / XSLT scripts, be sure to visit and share for all the newbs.

    i have set up a few example scripts to get you started. others are more knowledgeable than i and can answer more specific question, too.

    i've found learning the DOM to be a royal pita. php4 is very very different than php5. different versions of php5 behave very differently. my recommendation - get the latest and greatest php5 version. examples in the php online manual often don't work. there are undocumented capabilites.

    as a trick, you will likely find more information about xml when googling "javascript xml tutorial" or "jaascript DOM tutorial" - and then you can convert the code to php5 class style. it will often work.

    it is pretty cool, but it is a pita if you are swinging in the dark. too much missing or bad information. not very many examples that actually work - or examples that work with php4 or eralier versions of php5 but won't work with php5. or examples that just plain don't work!

    good luck!

  44. Signed up just to say DON'T BUY IT! by mindlessLemming · · Score: 2, Informative

    This is the most dissapointing PHP book I've read. The 'sample application' built during the course of the book is a complete P.O.S and has so little respect for the concept of instilling best practices early on that beginners are the LAST people I would be recommending this book to.

    Ok, so it's no good for beginner and too basic for anyone else...

    One positive note though -- the introduction to designing and using DTDs is quite good, especially for newbies, but that alone is not worth the price of the book.

    Purchasing this book also resulted in a regular flow of Sitepoint spam until I wrote an abusive email to their marketing department saying that I had most certainly never ticked any of their "Spam me to death" checkboxes and that I couldn't be any less interested in discounts on their books. Surprisingly, their response thanked me for the honest feedback.
    At least it ended well :)

  45. Re:Present in PHP5 and PEAR for PHP4..but where el by kv9 · · Score: 1

    PHP4 has DOM/expat/XSLT support. i suppose its not as comfy as PHP5, but i massage XML all the time and the tools available in 4 do the job.

  46. Read my own review of the book... by Regnard · · Score: 1

    Here

    It's brief but I hope it helps. It's a good book by the way.

    --
    Need a color? Try 100 random colors
  47. Unicode is for terrorists! by pestie · · Score: 1

    Unicode is of no use to those of us in these great United States! Everyone here speaks English, except those who don't, and to hell with them (literally - they're going to hell for being foreigners)! If you use Unicode, or even want to, the terrorists have won!

    God bless America