예제 #1
0
 protected LengthTypeFacet(DatatypeImpl _super) : base(_super)
 {
     measure = _super.GetMeasure();
     if (measure == null)
     {
         // TODO: localization
         throw new DatatypeException("unapplicable facet");
     }
 }
        public RangeFacet(object _limit, RangeChecker _checker, DatatypeImpl _super) : base(_super)
        {
            comparator = _super.GetComparator();
            if (comparator == null)
            {
                // TODO: localization
                throw new DatatypeException();
            }

            limit      = _limit;
            rangeCheck = _checker;
        }
        public void AddParameter(string name, string value, ValidationContext context)
        {
            if (type == UnimplementedDatatype.theInstance)
            {
                // allow any facet for unimplemented datatype
                return;
            }

            if (name == "length")
            {
                type = new LengthFacet(int.Parse(value), type);
                return;
            }
            if (name == "minLength")
            {
                type = new MinLengthFacet(int.Parse(value), type);
                return;
            }
            if (name == "maxLength")
            {
                type = new MaxLengthFacet(int.Parse(value), type);
                return;
            }
            if (name == "pattern")
            {
                // TODO: support
                // type = new PatternFacet( value, type );
                return;
            }
            if (name == "enumeration")
            {
                // enumeration: this facet will be rejected
                // TODO: specialized error message
                throw new DatatypeException();
            }
            if (name == "whiteSpace")
            {
                // whiteSpace facet is also not supported.
                // TODO: specialized error message
                throw new DatatypeException();
            }
            if (name == "maxInclusive")
            {
                type = new RangeFacet(
                    type.CreateValue(value, context),
                    new RangeFacet.RangeChecker(RangeFacet.MaxInclusive),
                    type);
                return;
            }
            if (name == "maxExclusive")
            {
                type = new RangeFacet(
                    type.CreateValue(value, context),
                    new RangeFacet.RangeChecker(RangeFacet.MaxExclusive),
                    type);
                return;
            }
            if (name == "minInclusive")
            {
                type = new RangeFacet(
                    type.CreateValue(value, context),
                    new RangeFacet.RangeChecker(RangeFacet.MinInclusive),
                    type);
                return;
            }
            if (name == "minExclusive")
            {
                type = new RangeFacet(
                    type.CreateValue(value, context),
                    new RangeFacet.RangeChecker(RangeFacet.MinExclusive),
                    type);
                return;
            }
            if (name == "totalDigits")
            {
                // TODO: support
                return;
            }
            if (name == "fractionDigits")
            {
                // TODO: support
                return;
            }

            // TODO: localization
            throw new DatatypeException("unsupported facet: " + name);
        }
 internal DatatypeBuilderImpl(DatatypeImpl _type)
 {
     this.type = _type;
 }
예제 #5
0
 public MinLengthFacet(int _length, DatatypeImpl _super) : base(_super)
 {
     this.length = _length;
 }
예제 #6
0
 protected ValueFacet(DatatypeImpl _super) : base(_super)
 {
 }
예제 #7
0
 protected DatatypeProxy(DatatypeImpl _super)
     : this(_super, _super.wsProcessor)
 {
 }
예제 #8
0
 protected Facet(DatatypeImpl _super, WhitespaceNormalizer.Processor proc)
     : base(_super, proc)
 {
 }
예제 #9
0
 protected DatatypeProxy(DatatypeImpl _super, WhitespaceNormalizer.Processor proc)
     : base(proc)
 {
     this.super = _super;
 }
예제 #10
0
 // TODO: Is RegEx compatible with XML Schema?
 protected PatternFacet(string regexp, DatatypeImpl _super)
     : base(_super)
 {
     pattern = new Regex('^' + regexp + '$');
 }