查询:
$.get("config.xml",function(xml){
$(xml).find("config").find("images").append("<image><url>../demo/Headline/2012/12/20/0/0/A/Content/8/Web201212_P8_medium.jpg</url><name></name><redirect>none</redirect></image>");
alert ($(xml).find("config").find("images").text());
});
XML:
<config>
<images>
<central>1</central>
<random>false</random>
<width>199</width>
<height>237</height>
<image>
<url>../demo/Headline/2012/12/20/0/0/A/Content/1/Web201212_P1_medium.jpg</url>
<name></name>
<redirect>none</redirect>
</image>
<image>
<url>../demo/Headline/2012/12/20/0/0/A/Content/2/Web201212_P2_medium.jpg</url>
<name></name>
<redirect>none</redirect>
</image>
<image>
<url>../demo/Headline/2012/12/20/0/0/A/Content/3/Web201212_P3_medium.jpg</url>
<name></name>
<redirect>none</redirect>
</image>
<image>
<url>../demo/Headline/2012/12/20/0/0/A/Content/4/Web201212_P4_medium.jpg</url>
<name></name>
<redirect>none</redirect>
</image>
<image>
<url>../demo/Headline/2012/12/20/0/0/A/Content/5/Web201212_P5_medium.jpg</url>
<name></name>
<redirect>none</redirect>
</image>
<image>
<url>../demo/Headline/2012/12/20/0/0/A/Content/6/Web201212_P6_medium.jpg</url>
<name></name>
<redirect>none</redirect>
</image>
<image>
<url>../demo/Headline/2012/12/20/0/0/A/Content/7/Web201212_P7_medium.jpg</url>
<name></name>
<redirect>none</redirect>
</image>
</images>
在上面的示例中,我可以附加一个字符串,例如。'abcdefg' 到 xml 节点。但是,当我使用 html 标签时,例如。就像示例一一样,我不能附加任何东西?如何解决这个问题?谢谢