1

I am using the below code in the javascript

text = LxmlHttp.responseText;
parser = new DOMParser();
xmlDoc = parser.parseFromString(text, "application/xml");
xmlDoc.setProperty('SelectionLanguage', 'XPath');

I am getting this error: Uncaught TypeError: Object #<Object> has no method 'setProperty'

Please help me solve the issue.

TIA..

Hi Felix, I have the below xml structure

<?xml version="1.0"?>
<response status="200">
  <ns3:op xmlns="http://xxx.com/details/" 
              xmlns:ns2="http://xxx.com/mgmt/" 
              xmlns:ns3="http://xxx.com/list/">
    <ns2:ntfs count="140">
      <ns2:ntf>
        <ns2:Nid>4687807</ns2:Nid>
      </ns2:ntf>
    </ns2:ntfs>
  </ns3:op>
</response>

I have to read this in IE 7, IE 8 , IE 9 , FF, safari and chrome

The namespace index may not be the same and might change. I need to parse the xml independent of the namespace and browser.

I am trying to do this

var xmlDoc = new DOMParser().parseFromString(....);
xmlDoc.setProperty("SelectionNamespaces", 'xmlns:ns3="http://xxx.com/list/"');
xmlDoc.setProperty("SelectionLanguage", "XPath");
var op = xmlDoc.selectSingleNode("/response/ns3:op");

This works only in IE. Please let me know how can i parse the xml in all browsers.


Constraints are database objects in themselves so it doesn't surprise me that the full description of the constraint is not shown when you run desc [interests]. Try desc [my_contacts_contact_id_fk]?

You should be able to execute alter table [interests] drop constraint [my_contacts_contact_id_fk]. If you are having trouble dropping can you post your alter table SQL and the response from the server?

4

1 回答 1

1

这仅适用于 IE

是的。setProperty是 MSXML 中的一种专有方法(实际上我根本不知道 IE 确实支持 XPath)。

有关标准解决方案,请参阅MDN 的文章Using XPath,赞成document.evaluate. 您应该使用功能检测来检查它是否可用,如果不可用,则回退到您的document.selectSingleNode.

于 2013-04-06T20:25:34.160 回答