I want to parse different XML that all of them have the same content but with this differences:
Some of the XML are like:
<ds:X509Data><ds:X509Certificate>MIIDtT[...]lLgXlaoNwM=</ds:X509Certificate></ds:X509Data>
Others are:
<dsig:X509Data><dsig:X509Certificate>MIIDtT[...]lLgXlaoNwM=</dsig:X509Certificate></dsig:X509Data>
I want to get the content of the "X509Certificate" node to save it in a file.
For other parts of the XML that are always the same, I was using:
doc.GetElementsByTagName("CountryName");
But I cant do the same here.
What should I do?
You can use XDocument Class and query it with LINQ.
var certificates = from doc in xDoc.Root.documents()
from attr in doc.Attributes()
where attr.Name.ToString().Contains("X509Certificate")
select attr;
You can now loop through certificates
and read in the values
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.