开发者

How to move through this xml file for getting the data?

<code>

<?xml version="1.0" encoding="iso-8859-1" ?>
<projects>

<project>
    <flag>1</flag>
    <name>Project 1</name>
    <descp> Short description. </descp>
    <rating> 6 </rating>
    <link> URL1 </link>
    </project>

<project>
    <flag>1</flag>
    <name>Project 2</name>
    <descp> Short description. </descp>
    <rating> 9 </rating>
    <link> URL2 </link>
    </project>

<project>
    <flag>1</flag>
    <name>Project 3</name>
    <descp> Short description. </descp>
    <rating> 4 </rating>
    <link> URL3 </link>
    </project>

<project>
    <flag>1</flag>
    <name>Project 4</name>
    <descp> Short descriptio开发者_JS百科n. </descp>
    <rating> 5 </rating>
    <link> URL4 </link>
    </project>

</projects>

</code>

I'm new to javascript and I'm having a problem after using getElementsbyTagName("project") where I get array of project tags. But now I'm confused how I can access the sub tags to get the data I need from this XML?


There is a getting started guide for XML with JavaScript here http://www.w3schools.com/xml/xml_parser.asp

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜