/// <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; DocumentationReference newDocumentationReference; IEnumerator enumerator; XmlElement iterationXmlElement; if (xmlElement == null) { throw new ArgumentNullException(nameof(xmlElement)); } xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable); xmlNamespaceManager.AddNamespace("xsd", XadesSignedXml.XadesNamespaceUri); this.documentationReferenceCollection.Clear(); xmlNodeList = xmlElement.SelectNodes("xsd:DocumentationReference", xmlNamespaceManager); enumerator = xmlNodeList.GetEnumerator(); try { while (enumerator.MoveNext()) { iterationXmlElement = enumerator.Current as XmlElement; if (iterationXmlElement != null) { newDocumentationReference = new DocumentationReference(); newDocumentationReference.LoadXml(iterationXmlElement); this.documentationReferenceCollection.Add(newDocumentationReference); } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } }
/// <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; DocumentationReference newDocumentationReference; IEnumerator enumerator; XmlElement iterationXmlElement; if (xmlElement == null) { throw new ArgumentNullException("xmlElement"); } xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable); xmlNamespaceManager.AddNamespace("xsd", XadesSignedXml.XadesNamespaceUri); this.documentationReferenceCollection.Clear(); xmlNodeList = xmlElement.SelectNodes("xsd:DocumentationReference", xmlNamespaceManager); enumerator = xmlNodeList.GetEnumerator(); try { while (enumerator.MoveNext()) { iterationXmlElement = enumerator.Current as XmlElement; if (iterationXmlElement != null) { newDocumentationReference = new DocumentationReference(); newDocumentationReference.LoadXml(iterationXmlElement); this.documentationReferenceCollection.Add(newDocumentationReference); } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } }