[英]How to get Destination value from xml
我有以下xml。 我需要獲取Destination的值,但它返回null。
String samlp = document.getElementsByTagName("samlp").item(0).getTextContent();
XML
<?xml version="1.0" encoding="UTF-8"?><samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" Destination="https://192.168.1.112/TestWeb/faces/acs.jsp?ent1.com" ID="_acb47035be4f862af61804c2192ed58fa100eba4fc" InResponseTo="ONELOGIN_91dd1c8a-5053-42c5-acc8-111111111" IssueInstant="2018-12-06T05:19:32Z" Version="2.0" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">
<saml:Issuer>https://example.com/test.php</saml:Issuer>
</samlp:Response>
您要查找的代碼是:
document.getElementsByTagName("samlp:Response").item(0).getAttributes().getNamedItem("Destination").getNodeValue()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.