Using this tutorial: http://www.phpbuilder.com/columns/justi ... hp3?page=3 , i am at the point where i know how to parse the xml file and print out the information formatted. i wanted to know how i could access the attributes in the xml and use them..
like if i had
<foo bar="green">foobar</foo>
i could make the html:
<font color="green">foobar</font>
i would somehow have to put it into $this->open_tag
XML Attr's
Moderator: General Moderators
- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact:
Just to post a followup to an IM discussion on this
Example three at php.net/xml gives an example of playing with the attributes.
Example three at php.net/xml gives an example of playing with the attributes.
Code: Select all
ї...]$this->open_tag = ї...]
"foo" => '<?php?>return("<font color="{$attrsї''bar'']}">");'
ї...]
function startElement($parser, $name, $attrs)
{
if ($format= $this->open_tagї$name])
{
if ("<?php?>" == substr($format, 0, 7))
{
$format= eval(substr($format, 7));
$this->html = $format;
}
else
$this->html .= $format;
}
}ї...]