我正在做一些非常简单的事情。我正在尝试从一个小的 XML 文件中检索一个节点。
<?xml version="1.0" encoding="UTF-8" ?>
<SAMLConfiguration xmlns="urn:componentspace:SAML:2.0:configuration">
<IdentityProvider Name="IdpNameInSPForIsuer"
Description="SecureAuth"
LocalCertificateFile=""
LocalCertificatePassword=""/>
<ServiceProviderProfiles>
<ServiceProvider NameIdentifier ="SPIssuerName"
ExpectsSignatureVerification="true"
ExpectsSignedResponse="false"
Certificate="sharedpubliccsert.cer"
DigestMethod="SAMLIdentifiers.DigestMethods.SHA1"
SignatureMethod="SAMLIdentifiers.SignatureMethods.RSA_SHA1"
SingleLogoutServiceUrl="https://serviceprovider/slo"
SendResponseBy="HTTP-Redirect" />
</ServiceProviderProfiles>
</SAMLConfiguration>
我正在尝试获取 ServiceProvider。以下是我拥有的 C# 代码:
字符串父 = "ServiceProviderProfiles"; 字符串孩子=“服务提供者”;
var nodePath = string.Concat(@"//", parent, @"/", children);
var xmlNode = xmlDocument.SelectSingleNode(nodePath);
当我调试时, xmlNode 为空。我的代码有什么问题导致 xmlNode 为空?