A Precondition instance is used to determine the applicability of a Rule to a XmlDocument.
Ejemplo n.º 1
0
        /// <summary>
        /// Constructs a <c>Rule</c> with the given name and that applies in
        /// the circumstances defines by its <see cref="Precondition"/>.
        /// </summary>
        /// <param name="precondition">A <see cref="Precondition"/> instance.</param>
        /// <param name="name">The unique name for the rule.</param>
        protected Rule(Precondition precondition, string name)
        {
            this.precondition = precondition;
            this.name		  = name;

            extent [name] = this;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Constructs a <b>SchemeRule</b> with the given name and that applies in
 /// the circumstances defined by its <see cref="Precondition"/>.
 /// </summary>
 /// <param name="precondition">A <see cref="Precondition"/> instance.</param>
 /// <param name="name">The unique name for the rule.</param>
 /// <param name="parentNames">The local names of the parent elements or <b>null</b>.</param>
 /// <param name="elementNames">An array of element names using the same scheme type for validation.</param>
 /// <param name="attributeName">The name of the attribute containing the scheme URI.</param>
 public SchemeRule(Precondition precondition, string name, string [] parentNames,
     string [] elementNames, string attributeName)
     : base(precondition, name)
 {
     this.parentNames   = parentNames;
     this.elementNames  = elementNames;
     this.attributeName = attributeName;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Construct a <b>ReferenceRule</b> instance that will locate
 /// context and target elements based on the data provided.
 /// </summary>
 /// <param name="precondition">A <see cref="Precondition"/> instance.</param>
 /// <param name="name">The unique name for the rule.</param>
 /// <param name="contextType">The schema type for the context element.</param>
 /// <param name="contextElements">An array of potential context element names.</param>
 /// <param name="targetType">The schema type for the target element.</param>
 /// <param name="targetElements">An array of potential target element names.</param>
 /// <param name="referenceAttribute">The name of the attribute containing the reference.</param>
 public ReferenceRule(Precondition precondition, string name,
     string contextType, string [] contextElements,
     string targetType, string [] targetElements,
     string referenceAttribute)
     : base(precondition, name)
 {
     this.contextType 		= contextType;
     this.contextElements 	= contextElements;
     this.targetType			= targetType;
     this.targetElements 	= targetElements;
     this.referenceAttribute = referenceAttribute;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Creates a new <b>Precondition</b> that is the logical NOT of the
 /// given arguments.
 /// </summary>
 /// <param name="pre">The <b>Precondition</b> to be inverted.</param>
 /// <returns>A new <b>Precondition</b> derived from the argument.</returns>
 public static Precondition Not(Precondition pre)
 {
     return (new NotPrecondition (pre));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Creates a new <b>Precondition</b> that is the logical AND of the
 /// given arguments.
 /// </summary>
 /// <param name="lhs">The left hand side <b>Precondition</b>.</param>
 /// <param name="rhs">The right hand side <b>Precondition</b>.</param>
 /// <returns>A new <b>Precondition</b> derived from the arguments.</returns>
 public static Precondition And(Precondition lhs, Precondition rhs)
 {
     return (new AndPrecondition (lhs, rhs));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Constructs a <b>UnaryPrecondition</b> instance.
 /// </summary>
 /// <param name="pre">The underlying <see  cref="Precondition"/>.</param>
 protected UnaryPrecondition(Precondition pre)
 {
     this.pre = pre;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Constructs a <b>OrPrecondition</b> which will derive its
 /// value from two underlying <see cref="Precondition"/> instances.
 /// </summary>
 /// <param name="lhs">The left hand <see cref="Precondition"/>.</param>
 /// <param name="rhs">The right hand <see cref="Precondition"/>.</param>
 public OrPrecondition(Precondition lhs, Precondition rhs)
     : base(lhs, rhs)
 {
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Constructs a <b>NotPrecondition</b> which will invert some
 /// underlying <see cref="Precondition"/>.
 /// </summary>
 /// <param name="pre">The underlying <see cref="Precondition"/>.</param>
 public NotPrecondition(Precondition pre)
     : base(pre)
 {
 }
 /// <summary>
 /// Constructs a <c>BrokenSchemeRule</c> with the given name and that applies in
 /// the circumstances defines by its <see cref="Precondition"/>.
 /// </summary>
 /// <param name="precondition">A <see cref="Precondition"/> instance.</param>
 /// <param name="name">The unique name for the rule.</param>
 /// <param name="elementName">An element name that uses a scheme for validation.</param>
 /// <param name="attributeName">The name of the attribute containing the scheme URI.</param>
 public BrokenSchemeRule(Precondition precondition, string name, string elementName, string attributeName)
     : this(precondition, name, new string [] { elementName }, attributeName)
 {
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Constructs a <c>DelegatedRule</c> with the given name and that
 /// applies in the circumstances defines by its <c>Precondition</c>.
 /// </summary>
 /// <param name="precondition">A <c>Precondition</c> instance.</param>
 /// <param name="name">The unique name for the rule.</param>
 /// <param name="function">The <see cref="RuleDelegate"/> delegate function.</param>
 public DelegatedRule(Precondition precondition, string name, RuleDelegate function)
     : base(precondition, name)
 {
     this.function = function;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Constructs a <b>UnaryPrecondition</b> instance.
 /// </summary>
 /// <param name="pre">The underlying <see  cref="Precondition"/>.</param>
 protected UnaryPrecondition(Precondition pre)
 {
     this.pre = pre;
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Creates a new <b>Precondition</b> that is the logical OR of the
 /// given arguments.
 /// </summary>
 /// <param name="lhs">The left hand side <b>Precondition</b>.</param>
 /// <param name="rhs">The right hand side <b>Precondition</b>.</param>
 /// <returns>A new <b>Precondition</b> derived from the arguments.</returns>
 public static Precondition Or(Precondition lhs, Precondition rhs)
 {
     return(new OrPrecondition(lhs, rhs));
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Creates a new <b>Precondition</b> that is the logical AND of the
 /// given arguments.
 /// </summary>
 /// <param name="lhs">The left hand side <b>Precondition</b>.</param>
 /// <param name="rhs">The right hand side <b>Precondition</b>.</param>
 /// <returns>A new <b>Precondition</b> derived from the arguments.</returns>
 public static Precondition And(Precondition lhs, Precondition rhs)
 {
     return(new AndPrecondition(lhs, rhs));
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Creates a new <b>Precondition</b> that is the logical NOT of the
 /// given arguments.
 /// </summary>
 /// <param name="pre">The <b>Precondition</b> to be inverted.</param>
 /// <returns>A new <b>Precondition</b> derived from the argument.</returns>
 public static Precondition Not(Precondition pre)
 {
     return(new NotPrecondition(pre));
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Constructs a <b>OrPrecondition</b> which will derive its
 /// value from two underlying <see cref="Precondition"/> instances.
 /// </summary>
 /// <param name="lhs">The left hand <see cref="Precondition"/>.</param>
 /// <param name="rhs">The right hand <see cref="Precondition"/>.</param>
 public OrPrecondition(Precondition lhs, Precondition rhs)
     : base(lhs, rhs)
 {
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Creates a new <b>Precondition</b> that is the logical OR of the
 /// given arguments.
 /// </summary>
 /// <param name="lhs">The left hand side <b>Precondition</b>.</param>
 /// <param name="rhs">The right hand side <b>Precondition</b>.</param>
 /// <returns>A new <b>Precondition</b> derived from the arguments.</returns>
 public static Precondition Or(Precondition lhs, Precondition rhs)
 {
     return (new OrPrecondition (lhs, rhs));
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Constructs a <c>DelegatedRule</c> with the given name and that
 /// applies in the circumstances defines by its <c>Precondition</c>.
 /// </summary>
 /// <param name="precondition">A <c>Precondition</c> instance.</param>
 /// <param name="name">The unique name for the rule.</param>
 /// <param name="function">The <see cref="RuleDelegate"/> delegate function.</param>
 public DelegatedRule(Precondition precondition, string name, RuleDelegate function)
     : base(precondition, name)
 {
     this.function = function;
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Construct a <b>ReferenceRule</b> instance that will locate
 /// context and target elements based on the data provided.
 /// </summary>
 /// <param name="precondition">A <see cref="Precondition"/> instance.</param>
 /// <param name="name">The unique name for the rule.</param>
 /// <param name="contextType">The schema type for the context element.</param>
 /// <param name="contextElements">An array of potential context element names.</param>
 /// <param name="targetType">The schema type for the target element.</param>
 /// <param name="targetElements">An array of potential target element names.</param>
 public ReferenceRule(Precondition precondition, string name,
     string contextType, string [] contextElements,
     string targetType, string [] targetElements)
     : this(precondition, name, contextType, contextElements, targetType, targetElements, "href")
 {
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Constructs a <c>SchemeRule</c> with the given name and that applies in
 /// the circumstances defined by its <see cref="Precondition"/>.
 /// </summary>
 /// <param name="precondition">A <see cref="Precondition"/> instance.</param>
 /// <param name="name">The unique name for the rule.</param>
 /// <param name="elementNames">An array of element names using the same scheme type for validation.</param>
 /// <param name="attributeName">The name of the attribute containing the scheme URI.</param>
 public SchemeRule(Precondition precondition, string name, string [] elementNames, string attributeName)
     : this(precondition, name, null, elementNames, attributeName)
 {
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Constructs a <c>BinaryPrecondition</c> instance.
 /// </summary>
 /// <param name="lhs">The left hand side <see cref="Precondition"/>.</param>
 /// <param name="rhs">The right hand side <see cref="Precondition"/>.</param>
 protected BinaryPrecondition(Precondition lhs, Precondition rhs)
 {
     this.lhs = lhs;
     this.rhs = rhs;
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Constructs a <b>NotPrecondition</b> which will invert some
 /// underlying <see cref="Precondition"/>.
 /// </summary>
 /// <param name="pre">The underlying <see cref="Precondition"/>.</param>
 public NotPrecondition(Precondition pre)
     : base(pre)
 {
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Constructs a <c>BinaryPrecondition</c> instance.
 /// </summary>
 /// <param name="lhs">The left hand side <see cref="Precondition"/>.</param>
 /// <param name="rhs">The right hand side <see cref="Precondition"/>.</param>
 protected BinaryPrecondition(Precondition lhs, Precondition rhs)
 {
     this.lhs = lhs;
     this.rhs = rhs;
 }