I am doing something very simple. I'm trying to retrieve a node from a small XML file.
<?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>
I am trying to get the ServiceProvider. Below is the C# code I have:
string parent = "ServiceProviderProfiles"; string children = "ServiceProvider";
var nodePath = string.Concat(@"//", parent, @"/", children);
var xmlNode = xmlDocument.SelectSingleNode(nodePath);
When I debug, the xmlNode is null. What problems with my code is causing the xmlNode to be null?
There are various ways for doing this.
Here is sample code