这是XML
文件:
<SketchPad>
<Player>
<TotalPage>2</TotalPage>
<BackgroundImage>/Users/ltlab/Library/Application Support/iPhone Simulator/5.1/Applications/D84490FE-3450-456C-A8FE-16BE8B1EB12C/Documents/publicUser_1356864779.441782_local.png</BackgroundImage>
<Name>1</Name>
<SelfBackgroundImage>sound.png</SelfBackgroundImage>
<Type>Record</Type>
<X_Value>0.000000</X_Value>
<Y_Value>38.000000</Y_Value>
<Height_Value>50.000000</Height_Value>
<Width_Value>50.000000</Width_Value>
<File_Path>null</File_Path>
</Player>
<Player>
<TotalPage>2</TotalPage>
<BackgroundImage>/Users/ltlab/Library/Application Support/iPhone Simulator/5.1/Applications/D84490FE-3450-456C-A8FE-16BE8B1EB12C/Documents/publicUser_1356864779.441782_local.png</BackgroundImage>
<Name>1</Name>
<SelfBackgroundImage>8_128x128.png</SelfBackgroundImage>
<Type>Stamp</Type>
<X_Value>7.000000</X_Value>
<Y_Value>716.000000</Y_Value>
<Height_Value>80.000000</Height_Value>
<Width_Value>80.000000</Width_Value>
<File_Path>null</File_Path>
</Player>
<Player>
<TotalPage>2</TotalPage>
<BackgroundImage>/Users/ltlab/Library/Application Support/iPhone Simulator/5.1/Applications/D84490FE-3450-456C-A8FE-16BE8B1EB12C/Documents/publicUser_1356864779.441782_local.png</BackgroundImage>
<Name>1</Name>
<SelfBackgroundImage>duck.png</SelfBackgroundImage>
<Type>Stamp</Type>
<X_Value>570.000000</X_Value>
<Y_Value>715.000000</Y_Value>
<Height_Value>80.000000</Height_Value>
<Width_Value>80.000000</Width_Value>
<File_Path>null</File_Path>
</Player>
</SketchPad>
我想要做的是收集标签内的所有数据。
$(xml).find("X_Value").toArray();
但它返回一个仍然包含标签的数组,如下所示:
[<x_value>0.0000000<x_value>,<x_value>7.0000000<x_value>,<x_value>570.0000000<x_value>]
不是预期的数组:
[0.0000000,7.0000000,570.0000000]
如何直接提取标签内的值,制作一个数组?
我真的不知道如何操作jQuery.map()
.