Fwd: help with XML_Transformer
| From: | Luke Barker | Date: | Thu, 04 Nov 2004 18:49:13 +0000 |
| Subject: | Fwd: help with XML_Transformer | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-15337@lists.php.net to get a copy of this message | ||
---------- Forwarded message ----------
From: Luke Barker <lukebarker@gmail.com>
Date: Thu, 4 Nov 2004 18:46:16 +0000
Subject: help with XML_Transformer
To: pear-general-digest@lists.php.net
Hi I am getting an error with a basic test script using XML_Transformer
here is my script - you can look at the way I have my PEAR files
installed too from the path...I think there is may be a problem with
this, as the error I quote below points to this.
<?php
$xml = '<xml><flights>hullo world</flights></xml>'; // is it OK to
use
XML in this form?
/* transform results for a flight search into XHTML */
ini_set( "include_path", ( "/home/semple/public_html/pear/PEAR-1.3.1/"));
require_once 'XML/Transformer.php'; // PEAR class to transform XML
using PHP on each element.
require_once 'XML/Transformer/Namespace.php';
class My_Transformer_Namespace extends Transformer_Namespace {
function start_flights($attributes)
{
//
// This method is mapped to the
// 'myelement' opening tag.
//
print '<h1>testing</h1>';
}
function end_flights($cdata)
{
//
// This method is mapped to the
// 'myelement' closing tag.
//
print '<h3>testing</h3>';
}
}
$myTransformer = new XML_Transformer();
$myTransformerNamespace = new My_Transformer_Namespace();
$myTransformer->overloadNamespace(
null,
&$myTransformerNamespace
); // null as XML is not strict XML
$myTransformer->transform($xml);
the error I get is --
Fatal error: Class my_transformer_namespace: Cannot inherit from
undefined class transformer_namespace in
/var/wwws/users/semple/tlink/xml_results.inc.php on line 8
But it is 'requiring' the files ok, so I am at a loss here.
I am quite new to PEAR so forgive me if I am doing somethign dumb. I
had to manually install the packages as my host does not have PEAR
installer working right.
thanks
Luke
--
lukebarker@gmail.com
battez@o2.co.uk
http://www.battez.org
--
lukebarker@gmail.com
battez@o2.co.uk
http://www.battez.org