- simplexml_load_string: documentation ( source)
<?php
$str=<<<XML
<?xml version = '1.0' encoding = 'UTF-8' standalone = 'yes'?>
<?xml-stylesheet href='http://alerts.weather.gov/cap/capatomproduct.xsl' type='text/xsl'?>
<!--
This atom/xml feed is an index to active advisories, watches and warnings
issued by the National Weather Service. This index file is not the complete
Common Alerting Protocol (CAP) alert message. To obtain the complete CAP
alert, please follow the links for each entry in this index. Also note the
CAP message uses a style sheet to convey the information in a human readable
format. Please view the source of the CAP message to see the complete data
set. Not all information in the CAP message is contained in this index of
active alerts.
-->
<alert xmlns = 'urn:oasis:names:tc:emergency:cap:1.1'>
<!-- http-date = Thu, 07 Jan 2016 03:13:00 GMT -->
<identifier>NOAA-NWS-ALERTS-AK1255E404AB04.HighWindWarning.1255E4059050AK.AFCNPWALU.aa449784ca013660f9a792ef2d17a43b</identifier>
<sender>w-nws.webmaster@noaa.gov</sender>
<sent>2016-01-06T18:13:00-09:00</sent>
<status>Actual</status>
<msgType>Alert</msgType>
<scope>Public</scope>
<note>Alert for Central Aleutians (Alaska) Issued by the National Weather Service</note>
<info>
<category>Met</category>
<event>High Wind Warning</event>
<urgency>Expected</urgency>
<severity>Severe</severity>
<certainty>Likely</certainty>
<eventCode>
<valueName>SAME</valueName>
<value>HWW</value>
</eventCode>
<effective>2016-01-06T18:13:00-09:00</effective>
<expires>2016-01-07T00:00:00-09:00</expires>
<senderName>NWS Anchorage (Southern Alaska - Anchorage)</senderName>
<headline>High Wind Warning issued January 06 at 6:13PM AKST until January 07 at 12:00AM AKST by NWS Anchorage</headline>
<description>...HIGH WIND WARNING REMAINS IN EFFECT UNTIL MIDNIGHT AKST
TONIGHT...
* LOCATION...FROM ADAK WEST.
* WIND...WEST 50 TO 60 MPH WITH GUSTS TO 85 MPH.
* TIMING...WINDS WILL PEAK IN INTENSITY LATE THIS AFTERNOON
THROUGH EARLY THIS EVENING AND THEN GRADUALLY DIMINISH
OVERNIGHT.
* IMPACTS...HIGH WINDS MAY MOVE LOOSE DEBRIS AND MAY DAMAGE
PROPERTY.</description>
<instruction>A HIGH WIND WARNING MEANS A HAZARDOUS HIGH WIND EVENT IS EXPECTED
OR OCCURRING. PEOPLE ARE URGED TO SECURE LOOSE OBJECTS THAT COULD
BE BLOWN AROUND OR DAMAGED BY THE WIND.</instruction>
<parameter>
<valueName>WMOHEADER</valueName>
<value></value>
</parameter>
<parameter>
<valueName>UGC</valueName>
<value>AKZ187</value>
</parameter>
<parameter>
<valueName>VTEC</valueName>
<value>/O.CON.PAFC.HW.W.0002.000000T0000Z-160107T0900Z/</value>
</parameter>
<parameter>
<valueName>TIME...MOT...LOC</valueName>
<value></value>
</parameter>
<area>
<areaDesc>Central Aleutians</areaDesc>
<polygon></polygon>
<geocode>
<valueName>FIPS6</valueName>
<value>002016</value>
</geocode>
<geocode>
<valueName>UGC</valueName>
<value>AKZ187</value>
</geocode>
</area>
</info>
</alert>
XML;
$xml=simplexml_load_string($str);
foreach($xml->xpath('//scale[@gender="*" or @gender="m"][@age="*" or @age="39-59"]/d[@scid="hi"][@raw="10"]/@t') as $t)
{
echo $t;
}