Reputation: 24052
Here's the XML I'm reading:
<?xml version="1.0" encoding="UTF-8"?>
<ns10:UtilityData xmlns:ns10="http://www.SDMX.org/resources/SDMXML/schemas/v1_0/message" xmlns="http://www.newyorkfed.org/xml/schemas/RateBase/utility" xmlns:ns11="http://www.SDMX.org/resources/SDMXML/schemas/v1_0/cross" xmlns:ns12="http://www.SDMX.org/resources/SDMXML/schemas/v1_0/compact" xmlns:ns13="http://www.SDMX.org/resources/SDMXML/schemas/v1_0/structure" xmlns:ns14="http://www.SDMX.org/resources/SDMXML/schemas/v1_0/utility" xmlns:ns15="http://www.SDMX.org/resources/SDMXML/schemas/v1_0/query" xmlns:ns16="http://rpc.xml.coldfusion" xmlns:ns2="http://www.newyorkfed.org/xml/schemas/FFBase/utility" xmlns:ns3="http://www.newyorkfed.org/xml/schemas/FF/utility" xmlns:ns4="http://www.newyorkfed.org/xml/schemas/FFMetadata/utility" xmlns:ns5="http://www.newyorkfed.org/xml/schemas/FFMethod/utility" xmlns:ns6="http://www.newyorkfed.org/xml/schemas/FFRange/utility" xmlns:ns7="http://www.newyorkfed.org/xml/schemas/FFTarget/utility" xmlns:ns8="http://www.SDMX.org/resources/SDMXML/schemas/v1_0/common" xmlns:ns9="http://www.SDMX.org/resources/SDMXML/schemas/v1_0/generic">
<ns10:Header>...</ns10:Header>
<DataSet>
<Series xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" AVAILABILITY="A" DECIMALS="2" DISCLAIMER="G" FF_METHOD="D" TIME_FORMAT="P1D" xsi:type="ns5:SeriesType">
<ns6:Key>
<FREQ>D</FREQ>
<RATE>FF</RATE>
<MATURITY>O</MATURITY>
<ns2:FF_SCOPE>D</ns2:FF_SCOPE>
</ns6:Key>
<ns3:Obs OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-08-24</TIME_PERIOD>
<OBS_VALUE>0.15</OBS_VALUE>
</ns3:Obs>
<ns3:Obs OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-08-21</TIME_PERIOD>
<OBS_VALUE>0.15</OBS_VALUE>
</ns3:Obs>
<ns3:Obs OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-08-20</TIME_PERIOD>
<OBS_VALUE>0.15</OBS_VALUE>
</ns3:Obs>
<ns3:Obs LAST_DAY_OF_MAINTENANCE_PERIOD="true" OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-08-19</TIME_PERIOD>
<OBS_VALUE>0.15</OBS_VALUE>
</ns3:Obs>
<ns3:Obs OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-08-18</TIME_PERIOD>
<OBS_VALUE>0.15</OBS_VALUE>
</ns3:Obs>
<ns3:Obs OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-08-17</TIME_PERIOD>
<OBS_VALUE>0.15</OBS_VALUE>
</ns3:Obs>
<ns3:Obs OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-08-14</TIME_PERIOD>
<OBS_VALUE>0.14</OBS_VALUE>
</ns3:Obs>
<ns3:Obs OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-08-13</TIME_PERIOD>
<OBS_VALUE>0.15</OBS_VALUE>
</ns3:Obs>
<ns3:Obs OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-08-12</TIME_PERIOD>
<OBS_VALUE>0.15</OBS_VALUE>
</ns3:Obs>
<ns3:Obs OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-08-11</TIME_PERIOD>
<OBS_VALUE>0.15</OBS_VALUE>
</ns3:Obs>
<ns3:Obs OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-08-10</TIME_PERIOD>
<OBS_VALUE>0.14</OBS_VALUE>
</ns3:Obs>
<ns3:Obs OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-08-07</TIME_PERIOD>
<OBS_VALUE>0.14</OBS_VALUE>
</ns3:Obs>
<ns3:Obs OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-08-06</TIME_PERIOD>
<OBS_VALUE>0.14</OBS_VALUE>
</ns3:Obs>
<ns3:Obs LAST_DAY_OF_MAINTENANCE_PERIOD="true" OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-08-05</TIME_PERIOD>
<OBS_VALUE>0.14</OBS_VALUE>
</ns3:Obs>
<ns3:Obs OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-08-04</TIME_PERIOD>
<OBS_VALUE>0.14</OBS_VALUE>
</ns3:Obs>
<ns3:Obs OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-08-03</TIME_PERIOD>
<OBS_VALUE>0.14</OBS_VALUE>
</ns3:Obs>
<ns3:Obs OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-07-31</TIME_PERIOD>
<OBS_VALUE>0.08</OBS_VALUE>
</ns3:Obs>
<ns3:Obs OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-07-30</TIME_PERIOD>
<OBS_VALUE>0.14</OBS_VALUE>
</ns3:Obs>
<ns3:Obs OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-07-29</TIME_PERIOD>
<OBS_VALUE>0.14</OBS_VALUE>
</ns3:Obs>
<ns3:Obs OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-07-28</TIME_PERIOD>
<OBS_VALUE>0.14</OBS_VALUE>
</ns3:Obs>
<ns3:Obs OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-07-27</TIME_PERIOD>
<OBS_VALUE>0.14</OBS_VALUE>
</ns3:Obs>
<ns3:Obs OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-07-24</TIME_PERIOD>
<OBS_VALUE>0.13</OBS_VALUE>
</ns3:Obs>
<ns3:Obs OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-07-23</TIME_PERIOD>
<OBS_VALUE>0.13</OBS_VALUE>
</ns3:Obs>
<ns3:Obs LAST_DAY_OF_MAINTENANCE_PERIOD="true" OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-07-22</TIME_PERIOD>
<OBS_VALUE>0.13</OBS_VALUE>
</ns3:Obs>
<ns3:Obs OBS_CONF="F" OBS_STATUS="A">
<TIME_PERIOD>2015-07-21</TIME_PERIOD>
<OBS_VALUE>0.13</OBS_VALUE>
</ns3:Obs>
</Series>
</DataSet>
</ns10:UtilityData>
What I want is the individual pairs of "TIME_PERIOD" and "OBS_VALUE", which represents a date and a value (as seen).
I kept using online XPATH testers and got no results when doing '/ns10:UtilityData/DataSet' - which I assumed would return that entire structure underneath.
What should the correct XPATH look like?
Upvotes: 0
Views: 113
Reputation: 7041
Try specifying a namespace with namespace-uri
:
//*[local-name()='Obs' and namespace-uri()='http://www.newyorkfed.org/xml/schemas/FF/utility']
Upvotes: 1