SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: XML DOM Error: Call to a member function on non-object.

  1. #1
    ¿uʍop ǝpısdn ʎɥʍ velocd's Avatar
    Join Date
    Aug 2002
    Location
    California
    Posts
    449
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question XML DOM Error: Call to a member function on non-object.

    I just enabled XML DOM on my localhost.

    The usual way of going about with XSLT functions isn't working though.

    PHP Code:
    $xmlfile 'xml_files/cats.xml';
    $xslfile 'xslt_files/index.xsl';

    $xmldoc domxml_open_file($xmlfile);
    $xsldoc domxml_xslt_stylesheet_file($xslfile);
            
    $result $xsldoc->process($xmldoc);  // line 139
            
    echo $result->dump_mem(); 
    Fatal error: Call to a member function on a non-object in C:\www\xml\index.php on line 139

    Is there something I skipped needing configuration? :^/

  2. #2
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Which version of PHP are we talking about ?

    If it's PHP4.x then as far as an XSL Stylesheet, you can forget about it This was fixed I believe in PHP5.x though I couldn't for the life of me get the DOM to work - proberly I missed installing a DLL I think; which one I have no idea

    There is a number of other options available to you in regards to XSL though you may try searching the PHP forums themselves on a specific thread started originally by HarryF ?

    This thread was basically a list of all template engines available to PHP; Someone (Sorry I cannot remember your name. Oooppss) had trialed a method of using XSL with the DOM though at the basic level I remember this used the Sablotron extension.

    Which is fine though not for heavy traffic sites mind you. I found another class which handled XSL as well which I put a link in these advanced forums in one thread or the other but I didn't bookmark it either

    Maybe a search by all my posts in the last 8 weeks would proberly shed some more light ? Umm...

    But PHP4.x is seriously buggy as far as XSL-T goes, shame really since I favour XML a lot for static data storage.

  3. #3
    ¿uʍop ǝpısdn ʎɥʍ velocd's Avatar
    Join Date
    Aug 2002
    Location
    California
    Posts
    449
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Drats, yeah I am on PHP 4.3.4.

    I had tried to install PHP5 since I figured before hand there was more XSLT support, but as I described in this thread, I can't seem to get it working with Apache. (maybe... iis?)

    Yeah, I will have a look for some other ways of going about XSL styesheets.

    Thanks.

  4. #4
    ¿uʍop ǝpısdn ʎɥʍ velocd's Avatar
    Join Date
    Aug 2002
    Location
    California
    Posts
    449
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dr Livingston, I did a search and found some of threads you've participated in from the past relating to XSL classes.

    http://www.sitepointforums.com/searc...earchid=425489

    Specifically this helluva long post:
    http://www.sitepointforums.com/showp...91&postcount=9

    You are using Salbatron, although above you've stated it's not great for heavy traffic (not that I plan to be using it in such a environment, maybe in the long run though).

    So the DOMXML classes are more reliable than the Salbatron? Will DOMXML become more standardized in the future (maybe around when PHP5 is stable) than Salbatron? Hopefully I am making relative comments, as I'm family new to XSL templating.

    Are your classes above in the single post the best to use for a model, or is there another project off Sourceforge you might recommend.

    I will also take a good look through phppatterns.

  5. #5
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sablotron is well on the way out currently today simply because it is slower than SAX or the DOM;

    The DOM is a standard and as far as I know, PHPs DOM (PHP4.2.x and above) relay the standard pretty well, though in some cases myself, I've had some serious trouble using for example GetElementsByTagName() yes ?

    I had to script my own solution to this, though from other developer's they've had no problems with this. uzzled:

    Anyways I'd advice that if you have to use Sablotron, then do so, though for the very short term only, until at least you can find another solution.

    How the DOM can be used with an XSL stylesheet (PHP4.x) I'd be interested to know myself But PHP5.x has been said to offer far better support though...

    ... Not much help to you at the moment I know

    I wouldn't say for certain that the DOM is more reliable than Sablotron, though a lot of hosts have the DOM extension by default; not so with the Sablotron extension, which is frowned upon in some cases - plus hosting with Sablotron is slightly more expensive and you do need to look around for a host offering the Sablotron extension.

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
  •