예제 #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;
            SPUri              newSPUri;
            SPUserNotice       newSPUserNotice;
            SigPolicyQualifier newSigPolicyQualifier;
            IEnumerator        enumerator;
            XmlElement         iterationXmlElement;
            XmlElement         subElement;

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

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

            this.sigPolicyQualifierCollection.Clear();
            xmlNodeList = xmlElement.SelectNodes("xsd:SigPolicyQualifier", xmlNamespaceManager);
            enumerator  = xmlNodeList.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    iterationXmlElement = enumerator.Current as XmlElement;
                    if (iterationXmlElement != null)
                    {
                        subElement = (XmlElement)iterationXmlElement.SelectSingleNode("xsd:SPURI", xmlNamespaceManager);
                        if (subElement != null)
                        {
                            newSPUri = new SPUri();
                            newSPUri.LoadXml(iterationXmlElement);
                            this.sigPolicyQualifierCollection.Add(newSPUri);
                        }
                        else
                        {
                            subElement = (XmlElement)iterationXmlElement.SelectSingleNode("xsd:SPUserNotice", xmlNamespaceManager);
                            if (subElement != null)
                            {
                                newSPUserNotice = new SPUserNotice();
                                newSPUserNotice.LoadXml(iterationXmlElement);
                                this.sigPolicyQualifierCollection.Add(newSPUserNotice);
                            }
                            else
                            {
                                newSigPolicyQualifier = new SigPolicyQualifier();
                                newSigPolicyQualifier.LoadXml(iterationXmlElement);
                                this.sigPolicyQualifierCollection.Add(newSigPolicyQualifier);
                            }
                        }
                    }
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        }
예제 #2
0
        /// <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 SigPolicyQualifier Add(SigPolicyQualifier objectToAdd)
        {
            base.Add(objectToAdd);

            return(objectToAdd);
        }