Ejemplo n.º 1
0
 private Validator PerformAssertion(Stream input, bool expected)
 {
     using(input)
     {
         Validator validator = new Validator(new XmlInput(new StreamReader(input)));
         Assert.AreEqual(expected, validator.IsValid, validator.ValidationMessage);
         return validator;
     }
 }
Ejemplo n.º 2
0
        internal void Check(SchemaInfo sinfo, Validator validator, ValidationEventHandler eventhandler) {
            Object o = null;
            string code = null;

            switch (RefType) {
            case ForwardRef.Type.ID:
                o = validator.FindID(ID);
                code = Res.Sch_UndeclaredId;
                break;
            case ForwardRef.Type.NOTATION:
                o = sinfo.Notations[ID];
                code = Res.Sch_UndeclaredNotation;
                break;
            }

            if (o == null) {
                string baseuri = (null != validator && null != validator.BaseUri ? validator.BaseUri.AbsolutePath : string.Empty);
                eventhandler(this, new ValidationEventArgs(new XmlSchemaException(code, ID, baseuri, Line, Col)));
            }
        }