0
我有一個這樣的xelement。訪問具有不同名稱空間的父項內具有名稱空間的XElement
<fiAPI xmlns="http://integration.fiapi.com" xmlns:ITI="http://www.ITIWnet.com/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xenc="http://www.w3.org/2001/xmlenc#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://integration.fiapi.com/fiAPI.xsd">
<fiHeader Version="2.2">
<Service Name="" Version="8.0">
<DateTime>2015-04-23T16:09:39-05:00</DateTime>
<UUID>d111bc1b-e539-47e6-93e0-d1c426346b78</UUID>
</Service>
<Security>
<AuthenticationMaterial>
<PrincipalPWD>
<EncryptedData>
<CipherData xmlns="http://www.w3.org/2001/04/xmlenc#">
<CipherValue></CipherValue>
</CipherData>
</EncryptedData>
</PrincipalPWD>
</AuthenticationMaterial>
<PrincipalID></PrincipalID>
<TrustRelationship>User</TrustRelationship>
<MessageDigest algorithm="SHA-1"></MessageDigest>
</Security>
</fiHeader>
</fiAPI>
我想設置一些值到這樣的CipherValue標記。
var loginRequestNameSpace = "http://integration.fiapi.com";
var cipherDataNameSpace = "http://www.w3.org/2001/04/xmlenc#";
XElement encryptedDataElement = loginRequestElement.Element(loginRequestNameSpace + "fiHeader").Element(loginRequestNameSpace + "Security").Element(loginRequestNameSpace + "AuthenticationMaterial").Element(loginRequestNameSpace + "PrincipalPWD").Element(loginRequestNameSpace + "EncryptedData");
XElement cypherDataElement = encryptedDataElement.Element(cipherDataNameSpace + "CipherData");
CipherData標籤讀取爲NULL。我在命名空間上做錯了什麼?有人可以幫忙嗎?