Get nested item from XML with jQuery

Posted by Dkong on Stack Overflow See other posts from Stack Overflow or by Dkong
Published on 2010-04-19T17:37:09Z Indexed on 2010/04/19 17:53 UTC
Read the original article Hit count: 278

Filed under:
|

I've looked at some examples on the web but I am still struggling with this. I would like to get the value for "descShort" tag within the "indexDesc" tag and then after that display the value from the "last" tag? I've seen people using the arrow > but I'm still lost.

<indices>
    <index>
        <code>DJI</code>
        <exchange>NYSE</exchange>
        <liveness>DELAYED</liveness>
        <indexDesc>
            <desc>Dow Jones Industrials</desc>
            <descAbbrev>DOW JONES</descAbbrev>
            <descShort>DOW JONES</descShort>
            <firstActive></firstActive>
            <lastActive></lastActive>
        </indexDesc>
        <indexQuote>
            <capital>
                <first>11144.57</first>
                <high>11153.79</high>
                <low>10973.92</low>
                <last>11018.66</last>
                <change>-125.9</change>
                <pctChange>-1.1%</pctChange>
            </capital>
            <gross>
                <first>11144.57</first>
                <high>11153.79</high>
                <low>10973.92</low>
                <last>11018.66</last>
                <change>-125.9</change>
                <pctChange>-1.1%</pctChange>
            </gross>
            <totalEvents>4</totalEvents>
            <lastChanged>16-Apr-2010 16:03:00</lastChanged>
        </indexQuote>
    </index>
    <index>
        <code>XAO</code>
        <exchange>ASX</exchange>
        <liveness>DELAYED</liveness>
        <indexDesc>
            <desc>ASX All Ordinaries</desc>
            <descAbbrev>All Ordinaries</descAbbrev>
            <descShort>ALL ORDS</descShort>
            <firstActive>06-Mar-1970</firstActive>
            <lastActive></lastActive>
        </indexDesc>
        <indexQuote>
            <capital>
                <first>5007.30</first>
                <high>5007.30</high>
                <low>4934.00</low>
                <last>4939.40</last>
                <change>-67.9</change>
                <pctChange>-1.4%</pctChange>
            </capital>
            <gross>
                <first>5007.30</first>
                <high>5007.30</high>
                <low>4934.00</low>
                <last>4939.40</last>
                <change>-67.9</change>
                <pctChange>-1.4%</pctChange>
            </gross>
            <totalEvents>997</totalEvents>
            <lastChanged>19-Apr-2010 17:02:54</lastChanged>
        </indexQuote>
    </index>
</indices>

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about Xml