XML - Get nth element from inside another element?
I had to restructure my XML data on my project and now my code does not work. Before the xml was structured like this:
- <project><copy></copy><image></image></project>
Now it is:
- <company><project><copy></copy><image></image></project><project><copy></copy><image></image></project><project><copy></copy><image></image></project></company>
This used to work to grab the image and copy, (this) being the 'project' element:
- text = $(this).find("copy").text();
- photo = "imgs/work/" + $(this).find("image").text();
Now, since there can be multiple 'project' elements inside a company element I have a counter that tracks which index I should be on, but I don't know the syntax for getting project(2) image and copy within a company. I tried the following code using eq, but it's not working.
- var currCompanyProj = 1;
- text = $((this).project.eq("+currCompanyProj+")).find("copy").text();
Any help on this? I know I have the syntax wrong...
Thanks in advance