Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Parsing through XSL

From: "Neil Smith [MVP Digital Media]" <neil@------.--->
To: NULL
Date: 2/7/2006 11:08:00 AM
On 6 Feb 2006 22:45:15 -0800, "sp" <Praveen.Kumar.SP@g...> wrote:

>i have an xml file
>
>
> <catalog>
> <cd>
>  <title>Empire Burlesque</title>
>  <artist>Bob Dylan</artist>
>  <country>USA</country>
>  <company>Columbia</company>
>  <price>10.90</price>
>  <year>1985</year>
>  </cd>
> </catalog>
>
>
>now i am working in C++ and my requirement
>is to get the artist value of each cd and store it in a array
>
>i wonder whether XSL could help me out in this scenario

Actually you want to just use XPath, which is the selection language
used in XSL. I'm not sure of the C++ syntax, but basically you want a
DOM method to get the results back - in Javascript this *is* returned
as an array of DOMNode objects : 


var result = xmlDoc.selectNodes("/catalog/cd/artist");
if (result != null) {
	for (i=0; i<result.length; i++) {
		alert(result[i].text);
	}
}

I'm sure you can adapt this easily enough - selectNodes is a standard
DOM function which should be available within your XML environment in
C++

HTH
Cheers - Neil


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