Beispiel #1
0
        /// <summary>
        /// Creates a new Status class using the XmlReade instance provided.
        /// </summary>
        /// <param name="reader">The XmlReader instance positioned at the Status node.</param>
        /// <param name="schemaVersion">The version of the schema that was used to validate.</param>
        public StatusElement(XmlReader reader, XacmlVersion schemaVersion)
            : base(XacmlSchema.Context, schemaVersion)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (reader.LocalName != Consts.ContextSchema.StatusElement.Status)
            {
                return;
            }
            while (reader.Read())
            {
                switch (reader.LocalName)
                {
                case Consts.ContextSchema.StatusElement.StatusCode:
                    StatusCode = new StatusCodeElement(reader, schemaVersion);
                    break;

                case Consts.ContextSchema.StatusElement.StatusMessage:
                    _statusMessage = reader.ReadElementString();
                    break;

                case Consts.ContextSchema.StatusElement.StatusDetail:
                    _statusDetail = reader.ReadElementString();
                    break;
                }
                if (reader.LocalName == Consts.ContextSchema.StatusElement.Status &&
                    reader.NodeType == XmlNodeType.EndElement)
                {
                    break;
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// Creates a StatusCode using an XmlReader instance provided.
 /// </summary>
 /// <param name="reader">The XmlReader instance positioned at the StatusCode node.</param>
 /// <param name="schemaVersion">The version of the schema that was used to validate.</param>
 public StatusCodeElement(XmlReader reader, XacmlVersion schemaVersion)
     : base(XacmlSchema.Context, schemaVersion)
 {
     if (reader == null)
     {
         throw new ArgumentNullException("reader");
     }
     if (reader.LocalName == Consts.ContextSchema.StatusElement.StatusCode)
     {
         _value = reader.GetAttribute(Consts.ContextSchema.StatusElement.Value);
         if (!reader.IsEmptyElement)
         {
             while (reader.Read())
             {
                 switch (reader.LocalName)
                 {
                 case Consts.ContextSchema.StatusElement.StatusCode:
                     _statusCode = new StatusCodeElement(reader, schemaVersion);
                     break;
                 }
                 if (reader.LocalName == Consts.ContextSchema.StatusElement.StatusCode &&
                     reader.NodeType == XmlNodeType.EndElement)
                 {
                     break;
                 }
             }
         }
     }
     else
     {
         throw new Exception(string.Format(Properties.Resource.exc_invalid_node_name, reader.LocalName));
     }
 }
Beispiel #3
0
 /// <summary>
 /// Creates a Status using the supplied values.
 /// </summary>
 /// <param name="statusCode">The status code.</param>
 /// <param name="statusMessage">The status message.</param>
 /// <param name="statusDetail">The status detail.</param>
 /// <param name="schemaVersion">The version of the schema that was used to validate.</param>
 public StatusElement(StatusCodeElement statusCode, string statusMessage, string statusDetail, XacmlVersion schemaVersion)
     : base(XacmlSchema.Context, schemaVersion)
 {
     StatusCode     = statusCode;
     _statusMessage = statusMessage;
     _statusDetail  = statusDetail;
 }
Beispiel #4
0
 /// <summary>
 /// Creates a status code using the values supplied.
 /// </summary>
 /// <param name="value">The value of the status code.</param>
 /// <param name="statusCode">Another inner status code.</param>
 /// <param name="schemaVersion">The version of the schema that was used to validate.</param>
 public StatusCodeElement(string value, StatusCodeElement statusCode, XacmlVersion schemaVersion)
     : base(XacmlSchema.Context, schemaVersion)
 {
     _value      = value;
     _statusCode = statusCode;
 }