我需要从 xml 节点获取内部 xml 我让这段代码在 IE 中完美运行,但使用 chrome 我无法获取内部 xml
var result_xml = UXmlHelper.text2xml(result.d); // create xml document
var xmlStr = $(result_xml).text();//i need to get the inner xml but in chrome it //return the text.
在 IE 中返回:<NewDataSet>
<Screens>
<TName>Screens</TName>
<AppId>1</AppId>
<AppName>MyStore_1</AppName>
<AppType>4</AppType>
<ScreenName>ScrHome</ScreenName>
<ScrId>9</ScrId>
<ScrPosition>1</ScrPosition>
<TemplateId>1</TemplateId>
<Xml>
<Screen id="ScrHome" position="1" type="Scr">
<Properties>
<Id>ScrHome</Id>
<Name>Home</Name>
</Properties>
<Style />
......
在 Chrome 中返回:
Screens1MyStore_14ScrHome911ScrHomeHomeCont_MainContainerurl(../Images/iphone-4_RealSize-2.JPG)no-repeat#DCE6F7265507Cont_InnerMainContainer8365Yellow338relativeImgScrollUpImgScrollUp../icons/UpArrow-3-Small.PNG1515scrollStartUpPhScrContImgScrollUpscrollEndImgScrollUpabsolute-7402PhScrContrtltruexxxjustTestrtl#DCE6F7hidden9986relative13ArialrtlImgScrollDownImgScroll....
我所拥有的:
var result_xml = UXmlHelper.text2xml(result.d); $(result_xml).find('NewDataSet').find("Screens").each(function () {
var parentScrNode = $(this).find("Xml");
});
在手表表达式中:
parentScrNode:
e.fn.e.init[1] 0: Element
context: Element
length: 1
prevObject: e.fn.e.init[1]
selector: "Xml" proto: Object[0] –
观看1: $(parentScrNode).html():[异常:TypeError:无法调用未定义的“替换”方法]观看2:
parentScrNode.html(): [Exception: TypeError: Cannot call method 'replace' of undefined] **Watch 3 :**
parentScrNode.text(): "ScrHomeHomeCont_MainContainerurl(../Images/iphone-4_RealSize-2.JPG)......
任何想法??
非常感谢。