A Precondition instance is used to determine the applicability of a Rule to a XmlDocument.
Esempio 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;
        }
 /// <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;
 }
 /// <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;
 }
 /// <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));
 }
 /// <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));
 }
 /// <summary>
 /// Constructs a <b>UnaryPrecondition</b> instance.
 /// </summary>
 /// <param name="pre">The underlying <see  cref="Precondition"/>.</param>
 protected UnaryPrecondition(Precondition pre)
 {
     this.pre = pre;
 }
 /// <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)
 {
 }
 /// <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)
 {
 }
 /// <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;
 }
 /// <summary>
 /// Constructs a <b>UnaryPrecondition</b> instance.
 /// </summary>
 /// <param name="pre">The underlying <see  cref="Precondition"/>.</param>
 protected UnaryPrecondition(Precondition pre)
 {
     this.pre = pre;
 }
 /// <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));
 }
 /// <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));
 }
 /// <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));
 }
 /// <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)
 {
 }
 /// <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));
 }
 /// <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;
 }
 /// <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")
 {
 }
Esempio 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)
 {
 }
 /// <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;
 }
 /// <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>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;
 }