SPUserNotice element is intended for being displayed whenever the signature is validated. The class derives from SigPolicyQualifier.
Наследование: SigPolicyQualifier
Пример #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>
        /// 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(nameof(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
            {
                if (enumerator is IDisposable disposable)
                {
                    disposable.Dispose();
                }
            }
        }