0

如果我有以下 XML:

<?xml version="1.0" encoding="utf-8"?>
<response>
    <status>SUCCESS</status>
    <result>
        <message>
            <field>
                <name>referenceNumber</name>
                <type>string</type>
                <required>true</required>
                <max>8</max>
                <min>0</min>
                <decimal_places>0</decimal_places>
            </field> ...

有没有办法获得响应/结果/消息的值?我知道我可以使用 find("message") 但如果有超过 1 个消息节点,则它不起作用。如果您知道我的意思,我想知道是否有一种无需“猜测”即可到达特定节点的方法。

谢谢

4

1 回答 1

0

你想使用find().each('message)` http://api.jquery.com/jQuery.each/有点像

`$(xml).find("listing").each(function (){ // 做事。});

于 2011-07-29T17:06:07.360 回答