I have a an xml file located at the URL specified, which includes a probability-of-precipitation node, which has several "value" elements whose schema-instance declaration(s) allows them to be nillable. However, the attributes() function in php does not show the XSI declarations of this element.
$feedURL= "http://forecast.weather.gov/MapClick.php?lat=32.78520&lon=-79.99400&FcstType=dwml";
// read feed into SimpleXML object
$wxml = simplexml_load_file($feedURL);
echo $wxml->data->parameters->{'probability-of-precipitation'}->value[0]->attributes();
Is it possible to print 'XSI attributes'?? Thanks
In the case of this $feedURL variable, the XML file passed includes an XML namespace directive which specifies that the namespace of the "XSI" prefix is referred to by the URI "http://www.w3.org/2001/XMLSchema-instance."
So, in order to access the attributes (@attributes) collection corresponding to the value[0] element, you need to specify this URI within the attributes function parameter value, e.g.:
The above will output in your browser:
if the xsi:nil="true" directive is passed in the current version of the http://forecast.weather.gov/MapClick.php?lat=32.78520&lon=-79.99400&FcstType=dwml XML file.