look at xml_set_character_data_handler()
it works fine for me

<?
class xml_class
{
  ...
  function xml_class()
  {
    $this->xml_parser = xml_parser_create();
    xml_set_object($this->xml_parser, $this);
    xml_set_element_handler($this->xml_parser, "start_element",
"end_element");
    xml_set_character_data_handler($this->xml_parser, "character_data");
  }
  ...
  function character_data($p, $d)
  {
    $d = trim(ereg_replace("\n", "", $d));
    if (!$d)  return;
    $this->curr_tag->data[] = $d;
  }
  ...
}
?>

-----Original Message-----
From: Sebastian A. [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 07, 2002 3:06 PM
To: PHP General List (PHP.NET)
Subject: RE: [PHP] Variables from XML Documents


The parsing is not the problem. I am already using the PHP XML parser, but
the problem is that it I cannot get the content of elements into variables
like I already stated. Does no one know how to do this?

-----Original Message-----
From: Analysis & Solutions [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 06, 2002 8:25 PM
To: PHP List
Subject: Re: [PHP] Variables from XML Documents

On Mon, May 06, 2002 at 08:20:46PM +0200, Sebastian A. wrote:
> <me>
>       <name>
>               Foo-Bar
>       </name>
> </me>
>
> What would I need to do, so that I can get the contents of the <name> tag
> (Foo-Bar) into a variable?

Check out my "PHP XML Parsing Basics" at
http://www.analysisandsolutions.com/code/phpxml.htm

--Dan

--
               PHP classes that make web design easier
        SQL Solution  |   Layout Solution   |  Form Solution
    sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to