0

我只想从下面代码中给出的 XML 节点(wsse:BinarySecurityToken)中获取值。

<head>
  <title>Working...</title>
</head>
<body>
<form method="POST"
        name="hiddenform"
        action="http://localhost:26298/LoginSuccess.aspx">
    <input type="hidden" name="wa" value="wsignin1.0" />
    <input type="hidden" name="wresult"
        value="<t:RequestSecurityTokenResponse xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust">
    <t:Lifetime><wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2013-04-29T11:50:29.895Z</wsu:Created><wsu:Expires xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2013-04-29T12:00:29.895Z</wsu:Expires></t:Lifetime><wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"><EndpointReference xmlns="http://www.w3.org/2005/08/addressing"><Address>urn:orin.converse</Address></EndpointReference></wsp:AppliesTo>
   <t:RequestedSecurityToken>    
       <wsse:BinarySecurityToken wsu:Id="uuid:5a48faca-2977-4c10-8cee-d213726f1971" ValueType="http://schemas.xmlsoap.org/ws/2009/11/swt-token-profile-1.0" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
             aHR0cCUzYSUyZiUyZnNjaGVtYXMubWljcm9zb2Z0LmNvbSUyZndzJTJmMjAwOCUyZjA2JTJmaWRlbnRpdHklMmZjbGFpbXMlMmZyb2xlPVVzZXImaHR0cCUzYSUyZiUyZnNjaGVtYXMueG1sc29hcC5vcmclMmZ3cyUyZjIwMDUlMmYwNSUyZmlkZW50aXR5JTJmY2xhaW1zJTJmZW1haWxhZGRyZXNzPWtyYWoubmFnJTQwZ21haWwuY29tJmh0dHAlM2ElMmYlMmZzY2hlbWFzLnhtbHNvYXAub3JnJTJmd3MlMmYyMDA1JTJmMDUlMmZpZGVudGl0eSUyZmNsYWltcyUyZm5hbWU9TmFnYXJhamFuK0thcnRoaWtleWFuJmh0dHAlM2ElMmYlMmZzY2hlbWFzLnhtbHNvYXAub3JnJTJmd3MlMmYyMDA1JTJmMDUlMmZpZGVudGl0eSUyZmNsYWltcyUyZm5hbWVpZGVudGlmaWVyPWh0dHBzJTNhJTJmJTJmd3d3Lmdvb2dsZS5jb20lMmZhY2NvdW50cyUyZm84JTJmaWQlM2ZpZCUzZEFJdE9hd2szaEtsblhkRzJsVmozX2F4bFJ1TlRVRzBMT09qdDJBayZodHRwJTNhJTJmJTJmc2NoZW1hcy5taWNyb3NvZnQuY29tJTJmYWNjZXNzY29udHJvbHNlcnZpY2UlMmYyMDEwJTJmMDclMmZjbGFpbXMlMmZpZGVudGl0eXByb3ZpZGVyPUdvb2dsZSZBdWRpZW5jZT11cm4lM2FvcmluLmNvbnZlcnNlJkV4cGlyZXNPbj0xMzY3MjM2ODI5Jklzc3Vlcj1odHRwcyUzYSUyZiUyZmNvbnZlcnNlLmFjY2Vzc2NvbnRyb2wud2luZG93cy5uZXQlMmYmSE1BQ1NIQTI1Nj04TjhQVmRFa1U0Q3NXODhnNVF1QVJkV0Q1c0t0dWxkS3RhY2NOaWd0Sjk0JTNk
       </wsse:BinarySecurityToken>
   </t:RequestedSecurityToken><t:TokenType>http://schemas.xmlsoap.org/ws/2009/11/swt-token-profile-1.0</t:TokenType><t:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</t:RequestType><t:KeyType>http://schemas.xmlsoap.org/ws/2005/05/identity/NoProofKey</t:KeyType></t:RequestSecurityTokenResponse>" />
    <noscript>
        <p>Script is disabled. Click Submit to continue.</p>
        <input type="submit" value="Submit" />
    </noscript>
</form>
<script language="javascript">window.setTimeout('document.forms[0].submit()', 0);</script>

任何人都可以提供示例代码吗?提前致谢。

4

2 回答 2

0

使用 NSXMLParser 及其委托

-(void)parser:(NSXMLParser*)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict

并使用...获取元素名称NSLog(@"%@",elementName);

于 2013-05-15T08:26:04.260 回答
0

您可以使用 xml 解析器将 xml 转换为 NSDictionary

https://github.com/nicklockwood/XMLDictionary

+ (NSDictionary *)dictionaryWithXMLData:(NSData *)data;
于 2013-05-15T07:59:04.383 回答