/// <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; IEnumerator enumerator; XmlElement iterationXmlElement; DataObjectFormat newDataObjectFormat; CommitmentTypeIndication newCommitmentTypeIndication; TimeStamp newTimeStamp; if (xmlElement == null) { throw new ArgumentNullException("xmlElement"); } xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable); xmlNamespaceManager.AddNamespace("xsd", XadesSignedXml.XadesNamespaceUri); this.dataObjectFormatCollection.Clear(); xmlNodeList = xmlElement.SelectNodes("xsd:DataObjectFormat", xmlNamespaceManager); enumerator = xmlNodeList.GetEnumerator(); try { while (enumerator.MoveNext()) { iterationXmlElement = enumerator.Current as XmlElement; if (iterationXmlElement != null) { newDataObjectFormat = new DataObjectFormat(); newDataObjectFormat.LoadXml(iterationXmlElement); this.dataObjectFormatCollection.Add(newDataObjectFormat); } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } this.dataObjectFormatCollection.Clear(); xmlNodeList = xmlElement.SelectNodes("xsd:CommitmentTypeIndication", xmlNamespaceManager); enumerator = xmlNodeList.GetEnumerator(); try { while (enumerator.MoveNext()) { iterationXmlElement = enumerator.Current as XmlElement; if (iterationXmlElement != null) { newCommitmentTypeIndication = new CommitmentTypeIndication(); newCommitmentTypeIndication.LoadXml(iterationXmlElement); this.commitmentTypeIndicationCollection.Add(newCommitmentTypeIndication); } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } this.dataObjectFormatCollection.Clear(); xmlNodeList = xmlElement.SelectNodes("xsd:AllDataObjectsTimeStamp", xmlNamespaceManager); enumerator = xmlNodeList.GetEnumerator(); try { while (enumerator.MoveNext()) { iterationXmlElement = enumerator.Current as XmlElement; if (iterationXmlElement != null) { newTimeStamp = new TimeStamp("AllDataObjectsTimeStamp"); newTimeStamp.LoadXml(iterationXmlElement); this.allDataObjectsTimeStampCollection.Add(newTimeStamp); } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } this.dataObjectFormatCollection.Clear(); xmlNodeList = xmlElement.SelectNodes("xsd:IndividualDataObjectsTimeStamp", xmlNamespaceManager); enumerator = xmlNodeList.GetEnumerator(); try { while (enumerator.MoveNext()) { iterationXmlElement = enumerator.Current as XmlElement; if (iterationXmlElement != null) { newTimeStamp = new TimeStamp("IndividualDataObjectsTimeStamp"); newTimeStamp.LoadXml(iterationXmlElement); this.individualDataObjectsTimeStampCollection.Add(newTimeStamp); } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } }
/// <summary> /// Add typed object to the collection /// </summary> /// <param name="objectToAdd">Typed object to be added to collection</param> /// <returns>The object that has been added to collection</returns> public CommitmentTypeIndication Add(CommitmentTypeIndication objectToAdd) { base.Add(objectToAdd); return(objectToAdd); }