예제 #1
0
		/// <summary>
		/// Create a new Response using the Result list provided.
		/// </summary>
		/// <param name="results">The list of Results that will be contained in this Response.</param>
		/// <param name="schemaVersion">The version of the schema that was used to validate.</param>
		public ResponseElement( ResultElement[] results, XacmlVersion schemaVersion )
			: base( XacmlSchema.Context, schemaVersion )
		{
			_results = new ResultCollection();
			if( results != null )
			{
				foreach( ResultElement result in results )
				{
					_results.Add( result );
				}
			}
		}
예제 #2
0
		/// <summary>
		/// Creates a response using the XmlReader instance provided.
		/// </summary>
		/// <remarks>This method is only provided for testing purposes, because it's easy to run the ConformanceTests
		/// comparing the expected response with the response created.</remarks>
		/// <param name="reader">The XmlReader positioned at the Response node.</param>
		/// <param name="schemaVersion">The version of the schema that was used to validate.</param>
		public ResponseElement( XmlReader reader, XacmlVersion schemaVersion )
			: base( XacmlSchema.Context, schemaVersion )
		{
            if (reader == null) throw new ArgumentNullException("reader");
			_results = new ResultCollection();
			if( reader.LocalName == ContextSchema.ResponseElement.Response )
			{
				while( reader.Read() )
				{
					switch( reader.LocalName )
					{
						case ContextSchema.ResultElement.Result:
							_results.Add( new ResultElement( reader, schemaVersion ) );
							break;
					}
					if( reader.LocalName == ContextSchema.ResponseElement.Response && 
						reader.NodeType == XmlNodeType.EndElement )
					{
						break;
					}
				}
			}
			else
			{
				throw new Exception( Resource.ResourceManager[ Resource.MessageKey.exc_invalid_node_name, reader.LocalName ] );
			}
		}