Why does simpleXML give me nested objects for blank tags?

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

 



I'm trying to use
http://us2.php.net/manual/en/function.simplexml-load-string.php
 
$xml_url =
file_get_contents('http://myserver/cgi-bin/dart.cgi?request=c901c906e4d06a0d
4bd4e2932379d7c6');
try
{
 $xml = simplexml_load_string($xml_url, 'SimpleXMLElement', LIBXML_NOBLANKS
& LIBXML_COMPACT & LIBXML_NOEMPTYTAG);
 print_r( $xml);
}
catch (Exception $e)
{
 echo "bad xml";
}
 
If I have this XML file:
 
<issue>
<crstatus>i_field_submitted</crstatus>
<problem_number>151827</problem_number>
<problem_synopsis_field>title</problem_synopsis_field>
<problem_description_field>description2</problem_description_field>
<fi_priority>High</fi_priority>
<assignee/>
<create_time>5/12/2009 22:53:10</create_time>
<fi_notes_oem/>
<fi_sw_part_name>sw_part_name</fi_sw_part_name>
<fi_general_reference>general_reference</fi_general_reference>
<fi_sw_part_number>sw_part_num</fi_sw_part_number>
<fi_customer_ecd_date>1244703600</fi_customer_ecd_date>
<fi_sw_part_version>sw_part_version</fi_sw_part_version>
<fi_required_date>1243839600</fi_required_date>
<ac_type/>
</issue>
 
Why does it give me sub-objects and not just empty strings for tags that
have no values as I'd expect??!
I tried all those options above and none of them make a difference.
SimpleXMLElement Object

(

    [crstatus] => i_field_submitted

    [problem_number] => 151827

    [problem_synopsis_field] => title

    [problem_description_field] => description2

    [fi_priority] => High

    [assignee] => SimpleXMLElement Object

        (

        )



    [fi_notes_oem] => SimpleXMLElement Object

        (

        )



    [fi_sw_part_name] => sw_part_name

    [fi_general_reference] => general_reference

    [fi_sw_part_number] => sw_part_num

    [fi_customer_ecd_date] => 1244703600

    [fi_sw_part_version] => sw_part_version

    [fi_required_date] => 1243839600

    [ac_type] => SimpleXMLElement Object

        (

        )



)



[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