note 84704 modified in ref.simplexml by danbrown
| From: | danbrown@php.net | Date: | Mon, 18 May 2009 01:09:36 +0000 |
| Subject: | note 84704 modified in ref.simplexml by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155486@lists.php.net to get a copy of this message | ||
For clarification, finding attributes seems easier this way, hope I'm not being redundant.
Source XML:
<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body type="small" important="low">Don't forget me this
weekend!</body>
</note>
Code Example:
<?php
$xml = simplexml_load_file("test.xml");
print $xml->body['type'];
?>
Output:
small
--was--
For clarification, finding attributes seems easier this way, hope I'm not being redundant.
Source XML:
<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body type="small" important="low">Don't forget me this
weekend!</body>
</note>
Code Example:
<?php
$xml = simplexml_load_file("test.xml");
print $xml->body['type'];
?>
Output:
small
http://php.net/manual/en/ref.simplexml.php