Exemple #1
0
        /// <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;
            CommitmentTypeQualifier newCommitmentTypeQualifier;

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

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

            this.commitmentTypeQualifierCollection.Clear();
            xmlNodeList = xmlElement.SelectNodes("xsd:CommitmentTypeQualifier", xmlNamespaceManager);
            enumerator  = xmlNodeList.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    iterationXmlElement = enumerator.Current as XmlElement;
                    if (iterationXmlElement != null)
                    {
                        newCommitmentTypeQualifier = new CommitmentTypeQualifier();
                        newCommitmentTypeQualifier.LoadXml(iterationXmlElement);
                        this.commitmentTypeQualifierCollection.Add(newCommitmentTypeQualifier);
                    }
                }
            }
            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 CommitmentTypeQualifier Add(CommitmentTypeQualifier objectToAdd)
        {
            base.Add(objectToAdd);

            return(objectToAdd);
        }