36 lines
1.3 KiB
C#
36 lines
1.3 KiB
C#
using System.Xml;
|
|
|
|
namespace Kreta.EESZTInterface
|
|
{
|
|
public class XmlHelper
|
|
{
|
|
public const string EncryptedDataElementName = "EncryptedData";
|
|
public const string EncryptedKeyElementName = "EncryptedKey";
|
|
public const string SecurityElementName = "Security";
|
|
public const string RequestSecurityTokenElementName = "RequestSecurityToken";
|
|
public const string HeaderElementName = "Header";
|
|
public const string BodyElementName = "Body";
|
|
public const string SignatureElementName = "Signature";
|
|
|
|
public static XmlElement GetElement(string element, string elementNS, XmlElement doc)
|
|
{
|
|
var list = doc.GetElementsByTagName(element, elementNS);
|
|
return list.Count == 0 ? null : (XmlElement)list[0];
|
|
}
|
|
|
|
public static XmlElement GetElementId(XmlDocument doc, string id)
|
|
{
|
|
XmlElement idElem = null;
|
|
|
|
if (idElem == null)
|
|
{
|
|
XmlNamespaceManager nsManager = new XmlNamespaceManager(doc.NameTable);
|
|
nsManager.AddNamespace("wsu", Namespaces.wsuNs);
|
|
|
|
idElem = doc.SelectSingleNode("//*[@wsu:Id=\"" + id + "\"]", nsManager) as XmlElement;
|
|
}
|
|
|
|
return idElem;
|
|
}
|
|
}
|
|
}
|