Microsoft.Xades.EncapsulatedPKIData.LoadXml C# (CSharp) Method

LoadXml() public method

Load state from an XML element
public LoadXml ( System xmlElement ) : void
xmlElement System XML element containing new state
return void
		public void LoadXml(System.Xml.XmlElement xmlElement)
		{
			if (xmlElement == null)
			{
				throw new ArgumentNullException("xmlElement");
			}

			if (xmlElement.HasAttribute("Id"))
			{
				this.id = xmlElement.GetAttribute("Id");
			}
			else
			{
				this.id = "";
			}

			this.pkiData = Convert.FromBase64String(xmlElement.InnerText);
		}

Usage Example

        /// <summary>
        /// Load state from an XML element
        /// </summary>
        /// <param name="xmlElement">XML element containing new state</param>
        public void LoadXml(System.Xml.XmlElement xmlElement)
        {
            XmlNamespaceManager xmlNamespaceManager;
            XmlNodeList         xmlNodeList;
            EncapsulatedPKIData newCertifiedRole;
            IEnumerator         enumerator;
            XmlElement          iterationXmlElement;

            if (xmlElement == null)
            {
                throw new ArgumentNullException("xmlElement");
            }

            xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable);
            xmlNamespaceManager.AddNamespace("xsd", XadesSignedXml.XadesNamespaceUri);

            this.certifiedRoleCollection.Clear();
            xmlNodeList = xmlElement.SelectNodes("xsd:CertifiedRole", xmlNamespaceManager);
            enumerator  = xmlNodeList.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    iterationXmlElement = enumerator.Current as XmlElement;
                    if (iterationXmlElement != null)
                    {
                        newCertifiedRole = new EncapsulatedPKIData("CertifiedRole");
                        newCertifiedRole.LoadXml(iterationXmlElement);
                        this.certifiedRoleCollection.Add(newCertifiedRole);
                    }
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        }
All Usage Examples Of Microsoft.Xades.EncapsulatedPKIData::LoadXml