开发者

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

开发者 https://www.devze.com 2023-03-19 00:01 出处:网络
<code> <?xml version=\"1.0\" encoding=\"iso-8859-1\" ?> <projects> <project> <flag>1</flag>
<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

精彩评论

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