Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


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

From: albruan@-------.---.(---------)
To: NULL
Date: 5/7/2009 10:00:00 AM
I'm using the XPath API along with XPathNodeIterators.  What you wrote was a 
tremendous help.  Thanks!

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


"Martin Honnen" wrote:

> AlBruAn wrote:
> > 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!
> 
> Well XSLT helps if you want to transform your XML to another XML format 
> or to HTML or to plain text and it uses XPath anyway to select and match 
> nodes so I am not sure why you don't know where to start if you could 
> deal with XPath for other documents.
> Which XPath API or XSLT processor (e.g. MSXML or .NET) do you want to use?
> XPaths are as simple as
> 
> /packet/ns1:data/perf_mon/data[@xsi:type = 'ns2:perf_dataType']
> 
> then relative to that
> 
> ns2:class[ns2:name = 
> 'counters_vz_cpu']/ns2:instance/ns2:counter[ns2:name = 
> 'counter_cpu_idle']/ns2:value/ns2:avg
> 
> 
> where you simply need to bind the prefixes used in the XML to the 
> namespace URIs used in the XML. How you do that depends on the API you 
> use/want to use so we need to establish that first before showing code 
> how to do that.
> 
> -- 
> 
> 	Martin Honnen --- MVP XML
> 	http://msmvps.com/blogs/martin_honnen/
> 


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