Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


How can I go about parsing this XML for the info I need?

From: albruan@-------.---.(---------)
To: NULL
Date: 5/7/2009 8:42:00 AM
Using code similar to the snippet I'm pasting below, I need to be able to 
loop through the XML and retrieve specific pieces of information such as the 
average counter_cpu_idle, the average counter_cpu_idle_states, etc.  The file 
includes multiple entries along the line of <data 
xsi:type="ns2:perf_dataType">.  

Other information I needed from a different XML file was easy to navigate to 
with simple XPath statements, but this looked like it requires XSLT...and I'm 
not sure where to start.  Any help would be greatly appreciated!

<?xml version="1.0" encoding="UTF-8"?>
<packet xmlns:ns1="http://www.swsoft.com/webservices/vzl/4.0.0/protocol" 
        xmlns:ns2="http://www.swsoft.com/webservices/vzl/4.0.0/types" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        time="2009-05-05T17:56:17+0000" priority="0" version="4.0.0">
  <ns1:origin>perf_mon</ns1:origin>
  <ns1:target>vzclient12-64881bf8-4953-4d5d-e80a-8e1e49b4a2ab</ns1:target>
  <ns1:dst>
    <director>gend</director>
  </ns1:dst>
  <ns1:data>
    <perf_mon>
      <data xsi:type="ns2:perf_dataType">
        <ns2:eid>42b1462a-ed4b-40b9-b627-75b364719731</ns2:eid>
        <ns2:interval xsi:type="ns2:intervalType">
          <ns2:start_time>2009-05-05T17:41:17+0000</ns2:start_time>
          <ns2:end_time>2009-05-05T17:56:17+0000</ns2:end_time>
        </ns2:interval>
        <ns2:class>
          <ns2:name>counters_vz_cpu</ns2:name>
          <ns2:instance>
            <ns2:name></ns2:name>
            <ns2:counter>
              <ns2:name>counter_cpu_idle</ns2:name>
              <ns2:value>
                <ns2:avg>36008546270</ns2:avg>
                <ns2:min>36008546270</ns2:min>
                <ns2:max>36008546270</ns2:max>
                <ns2:cur>36008546270</ns2:cur>
              </ns2:value>
            </ns2:counter>
            <ns2:counter>
              <ns2:name>counter_cpu_idle_states</ns2:name>
              <ns2:value>
                <ns2:avg>99</ns2:avg>
                <ns2:min>99</ns2:min>
                <ns2:max>100</ns2:max>
                <ns2:cur>100</ns2:cur>
              </ns2:value>
            </ns2:counter>
            <ns2:counter>
              <ns2:name>counter_cpu_limit</ns2:name>
              <ns2:value>
                <ns2:avg>100.000000</ns2:avg>
                <ns2:min>100.000000</ns2:min>
                <ns2:max>100.000000</ns2:max>
                <ns2:cur>100.000000</ns2:cur>
              </ns2:value>
            </ns2:counter>

-- 
Things are more like they are now than they ever have been before.


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent