How do I get Nokogiri to understand my namespaces?

后端 未结 2 1358
迷失自我
迷失自我 2020-12-17 02:23

I have the following XML document:


  @NOT_USED@         


        
2条回答
  •  天命终不由人
    2020-12-17 03:19

    It doesn't look like the namespaces in this document are correctly declared - there should be xmlns:samlp and xmlns:saml attributes on the root node. In cases like this, Nokogiri essentially ignores the namespaces (as it can't map them to URIs or URNs), so your XPath works if you remove them, i.e.

    doc.xpath(XPATH_QUERY)
    

提交回复
热议问题