SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: PHP5 XML doco?

  1. #1
    SitePoint Zealot tezza's Avatar
    Join Date
    Aug 2003
    Location
    Australia
    Posts
    155
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP5 XML doco?

    I'm going through the process of upgrading my PHP4 XML codebase to PHP5

    The vast majority of the new DOM methods are documented (in the online PHP manual), but there seems to be no doco for essential DOM properties - like $doc->documentElement. Yet I only see these popping up in some of the examples posted by users.

    Am I missing something?

    At the moment, I'm trying to find a replacement for $el->set_content() which is now obsolete in PHP5. If someone can point me to a reference where this info is kept, I would be most appreciative.

  2. #2
    SitePoint Evangelist
    Join Date
    Dec 2003
    Location
    Arizona
    Posts
    411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by tezza
    I'm going through the process of upgrading my PHP4 XML codebase to PHP5

    The vast majority of the new DOM methods are documented (in the online PHP manual), but there seems to be no doco for essential DOM properties - like $doc->documentElement. Yet I only see these popping up in some of the examples posted by users.

    Am I missing something?

    At the moment, I'm trying to find a replacement for $el->set_content() which is now obsolete in PHP5. If someone can point me to a reference where this info is kept, I would be most appreciative.
    To change the content of a node that has already been created, I think that you do something like this:

    PHP Code:
    $node->nodeValue $someContent
    JT

  3. #3
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Off Topic:


    Hows XAO, changed now, with PHP5?

  4. #4
    SitePoint Zealot tezza's Avatar
    Join Date
    Aug 2003
    Location
    Australia
    Posts
    155
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    XAO progress

    Quote Originally Posted by Andrew-J2000
    Off Topic:


    Hows XAO, changed now, with PHP5?
    I've been slack with maintaining the website. XAO has actually sustained some pretty signifigant changes even in it's PHP4 incarnation.** Unfortunately I haven't had time to put together a decent change-set and post it with a version increment. I've used it to develop a couple of applications since I last updated the website.

    There are some nasty hacks in the PHP4 version of XAO due to the DOM XML implementation in PHP4 bein "experimental". For example, if you look at DomDoc::ndConsumeXXX methods, I've expoited a bug to import documents.

    I loaded PHP5 onto my windows box for the first time just the other day and was horrified to find that there is no backwards compatability for PHP4's DOM XML extension. At least, it wasn't bundled with php_domxml .dll

    In any case XAO should benefit quite signifigantly from PHP5's libxml2 implementation. For a start, namespaces should be supported properly. Validation is supported properly. I wouldn't have to resort to a separate XSLT implementation. And performance is reportedly improved greatly.

    I could have just gone through and updated some function names to bring it up to PHP5 compatability but I have opted to rewrite the code from scratch. Structurally things will not change that much. At least the user API for XAO won't change much. Some of the new functionality will make some of my implementation code obsolete - which I am really looking forward to. It's possible that after the conversion there will be less lines of code.

    The new exception handling of PHP5 may require a total re-engineering of the XAO exceptional handling methodology. Then again it may not. I've already written XaoException which extends the built in PHP5 Exception class. I'm still deciding on the implementation.

    I had some other developers who wanted to contribute to the project but it's difficult to get people to stick to the XAO methodology so I just decided to try and do it all myself. Perhaps after version 1.0 goes stable, I will articulate some guidelines and then others can work on the code again.

    I'm hoping to have a beta version of XAO ready for public testing in a couple of weeks. I want the beta testing phase to be fairly short. Basically, the feature set will stay the same but I will just fix all the bugs and then XAO will go 1.0 stable.

    ** One new change that I am excited about is the DbToXmlTree class which inherits DbToXml. Basically you can feed it a tabular result set (2d associative array) specifying a "parent" column name and the name of the "primary key" column. Using this info, it implements a recursive function call to generate the tree structure implied by the data table. I find that I use this all the time. It's so trivial to utilise.

  5. #5
    SitePoint Zealot tezza's Avatar
    Join Date
    Aug 2003
    Location
    Australia
    Posts
    155
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by seratonin
    To change the content of a node that has already been created, I think that you do something like this:

    PHP Code:
     $node->nodeValue $someContent
    JT
    Thanks for the tip JT. I noticed that the nodeValue property is not documented at http://www.php.net/manual/en/ref.dom.php
    I guess the main purpose of my query was to find out where stuff like this is documented. I should have known to look for it at the W3C. It would have been nice if the PHP manual put a link to
    http://www.w3.org/TR/2000/REC-DOM-Le...1113/core.html
    as a reminder - assuming libxml2 is a DOM level 2 implementation. Likewise for the libxml website - although they do sport a link to gdome2.

  6. #6
    SitePoint Guru dagfinn's Avatar
    Join Date
    Jan 2004
    Location
    Oslo, Norway
    Posts
    894
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This presentation was useful to me when I started looking into PHP5 DOM. For all I know, there may be better things out there now.
    Dagfinn Reiersøl
    PHP in Action / Blog / Twitter
    "Making the impossible possible, the possible easy,
    and the easy elegant"
    -- Moshe Feldenkrais


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •