note 84704 modified in ref.simplexml by thiago
| From: | thiago@php.net | Date: | Tue, 29 Jul 2008 14:30:16 +0000 |
| Subject: | note 84704 modified in ref.simplexml by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142897@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:
<?
$xml = simplexml_load_file("test.xml");
print $xml->body['type'];
?>
Output:
small
http://php.net/manual/en/ref.simplexml.php