Re: problem with PHP simplexml and doxygen generated XML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I HAVE THE SAME PROBLEM, PLEASE HOW HAVE YOU DONE IT
>
> On Sun, Apr 5, 2009 at 4:08 PM, <hessiess@xxxxxxxxxxxx> wrote:
>
>> >
>> >
>> > On Apr 3, 2009, at 17:52, hessiess@xxxxxxxxxxxx wrote:
>> >
>> >> I have bean trying to right a PHP script to generate XHTML code from
>> >> the
>> >> class documentation xml files created by Doxygen(the HTML it outputs
>> >> is
>> >> invalid, messy and virtually imposable to integrate into another web
>> >> page). One thing has bean causing problems, the tags which start
>> >> with `@',
>> >> for example:
>> >>
>> >> Code:
>> >>  SimpleXMLElement Object
>> >>  (
>> >>    [@attributes] => Array
>> >>        (
>> >>            [kind] => function
>> >>            [id] => classhello_1f06929bd13d07b414a8be07c6db88074
>> >>            [prot] => private
>> >>            [static] => no
>> >>            [const] => no
>> >>            [explicit] => no
>> >>            [inline] => yes
>> >>            [virt] => non-virtual
>> >>        )
>> >>  ...
>> >>
>> >> I cannot seam to find a way to access these with simplexml, the
>> >> following
>> >> code generates a syntax error for example.
>> >>
>> >> Code:
>> >>
>> >> print_r($xml->compounddef->sectiondef->memberdef[1]->@attributes);
>> >>
>> >> Any advice would be gratily appreciated.
>> >>
>> >>
>> >> --
>> >> PHP General Mailing List (http://www.php.net/)
>> >> To unsubscribe, visit: http://www.php.net/unsub.php
>> >>
>> >
>> > What about first stripping out the @ characters with str_replace and
>> > then attempting to load the XML? Maybe run it thru a few to do the
>> > best possible clean up?
>> >
>> > Bastien
>> >
>>
>> Found out what I was doing wrong, the problem has nothing to do with the
>> XML code, tag attributes are put into the @attributes section, which
>> must
>> be accsessed with the attributes() function.
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
> --
> Best Wishes
> Andrew Williams
>

Just use the attributes() function, for example:
$xml->compounddef->sectiondef->memberdef[0]->attributes()->kind

Also, no need to shout ;)


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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux