SendValidationEvent() 개인적인 메소드

private SendValidationEvent ( XmlSchemaException e ) : void
e XmlSchemaException
리턴 void
예제 #1
0
 /*
     <extension 
       base = QName 
       id = ID 
       {any attributes with non-schema namespace . . .}>
       Content: (annotation? , ((group | all | choice | sequence)? , ((attribute | attributeGroup)* , anyAttribute?)))
     </extension>
 */
 private static void InitComplexContentExtension(XsdBuilder builder, string value) {
     if (builder.complexContent.Content != null) {
         builder.SendValidationEvent(Res.Sch_ComplexContentContentModel, "extension");
     }
     builder.xso = builder.complexContentExtension = new XmlSchemaComplexContentExtension();
     builder.complexContent.Content = builder.complexContentExtension;
 }
 private static void InitAnnotation(XsdBuilder builder, string value)
 {
     if ((builder.hasChild && (builder.ParentElement != SchemaNames.Token.XsdSchema)) && (builder.ParentElement != SchemaNames.Token.XsdRedefine))
     {
         builder.SendValidationEvent("Sch_AnnotationLocation", null);
     }
     builder.xso = builder.annotation = new XmlSchemaAnnotation();
     builder.ParentContainer.AddAnnotation(builder.annotation);
 }
예제 #3
0
 /*
     <complexType 
       abstract = boolean : false
       block = #all or (possibly empty) subset of {extension, restriction} 
       final = #all or (possibly empty) subset of {extension, restriction} 
       id = ID 
       mixed = boolean : false
       name = NCName 
       {any attributes with non-schema namespace . . .}>
       Content: (annotation? , (simpleContent | complexContent | ((group | all | choice | sequence)? , ((attribute | attributeGroup)* , anyAttribute?))))
     </complexType>
 */
 private static void InitComplexType(XsdBuilder builder, string value) {
     builder.xso = builder.complexType = new XmlSchemaComplexType();
     switch (builder.ParentElement) {
         case SchemaNames.Token.XsdSchema:
             builder.canIncludeImport = false;  // disable import and include elements in schema
             builder.schema.Items.Add(builder.complexType);                    
             break;
         case SchemaNames.Token.XsdRedefine:
             builder.redefine.Items.Add(builder.complexType);                    
             break;
         case SchemaNames.Token.XsdElement:
             if (builder.element.SchemaType != null) {
                 builder.SendValidationEvent(Res.Sch_DupElement, "complexType");
             }
             if (builder.element.Constraints.Count != 0) {
                 builder.SendValidationEvent(Res.Sch_TypeAfterConstraints, null);
             }
             builder.element.SchemaType = builder.complexType;
             break;
     }
 }
예제 #4
0
 /*
     <selector 
       id = ID 
       xpath = An XPath expression 
       {any attributes with non-schema namespace . . .}>
       Content: (annotation?)
     </selector>
 */
 private static void InitSelector(XsdBuilder builder, string value) {
     builder.xso = builder.xpath = new XmlSchemaXPath();
     if ( builder.identityConstraint.Selector == null ) {
         builder.identityConstraint.Selector = builder.xpath;
     }
     else {
         builder.SendValidationEvent(Res.Sch_DupSelector, builder.identityConstraint.Name);
     }
 }
예제 #5
0
 /*
     <annotation>
       Content: (appinfo | documentation)*
     </annotation>
 */
 private static void InitAnnotation(XsdBuilder builder, string value) {
     // On most elements annotations are only allowed to be the first child 
     //   (so the element must not have any children by now), and only one annotation is allowed.
     // Exceptions are xs:schema and xs:redefine, these can have any number of annotations
     //   in any place.
     if (builder.hasChild && 
         builder.ParentElement != SchemaNames.Token.XsdSchema &&
         builder.ParentElement != SchemaNames.Token.XsdRedefine) {
         builder.SendValidationEvent(Res.Sch_AnnotationLocation, null);
     }
     builder.xso = builder.annotation = new XmlSchemaAnnotation();
     builder.ParentContainer.AddAnnotation(builder.annotation);
 }
예제 #6
0
 /*
     <anyAttribute 
       id = ID 
       namespace = ##any | ##other | list of {uri, ##targetNamespace, ##local} : ##any
       processContents = skip | lax | strict : strict
       {any attributes with non-schema namespace . . .}>
       Content: (annotation?)
     </anyAttribute>
 */
 private static void InitAnyAttribute(XsdBuilder builder, string value) {
     builder.xso = builder.anyAttribute = new XmlSchemaAnyAttribute();
     switch (builder.ParentElement) {
         case SchemaNames.Token.XsdComplexType:
             if (builder.complexType.ContentModel != null) {
                 builder.SendValidationEvent(Res.Sch_AttributeMutuallyExclusive, "anyAttribute");
             }
             if (builder.complexType.AnyAttribute != null) {
                 builder.SendValidationEvent(Res.Sch_DupElement, "anyAttribute");
             }
             builder.complexType.AnyAttribute = builder.anyAttribute;
             break;
         case SchemaNames.Token.XsdSimpleContentRestriction:
             if (builder.simpleContentRestriction.AnyAttribute != null) {
                 builder.SendValidationEvent(Res.Sch_DupElement, "anyAttribute");
             }
             builder.simpleContentRestriction.AnyAttribute = builder.anyAttribute;
             break;
         case SchemaNames.Token.XsdSimpleContentExtension:
             if (builder.simpleContentExtension.AnyAttribute != null) {
                 builder.SendValidationEvent(Res.Sch_DupElement, "anyAttribute");
             }
             builder.simpleContentExtension.AnyAttribute = builder.anyAttribute;
             break;
         case SchemaNames.Token.XsdComplexContentExtension:
             if (builder.complexContentExtension.AnyAttribute != null) {
                 builder.SendValidationEvent(Res.Sch_DupElement, "anyAttribute");
             }
             builder.complexContentExtension.AnyAttribute = builder.anyAttribute;
             break;
         case SchemaNames.Token.XsdComplexContentRestriction:
             if (builder.complexContentRestriction.AnyAttribute != null) {
                 builder.SendValidationEvent(Res.Sch_DupElement, "anyAttribute");
             }
             builder.complexContentRestriction.AnyAttribute = builder.anyAttribute;
             break;
         case SchemaNames.Token.xsdAttributeGroup:
             if (builder.attributeGroup.AnyAttribute != null) {
                 builder.SendValidationEvent(Res.Sch_DupElement, "anyAttribute");
             }
             builder.attributeGroup.AnyAttribute = builder.anyAttribute;
             break;
     }
 }
예제 #7
0
        /*
            <unique 
              id = ID 
              name = NCName 
              {any attributes with non-schema namespace . . .}>
              Content: (annotation? , (selector , field+))
            </unique>
 
            <key 
              id = ID 
              name = NCName 
              {any attributes with non-schema namespace . . .}>
              Content: (annotation? , (selector , field+))
            </key>
 
            <keyref 
              id = ID 
              name = NCName 
              refer = QName 
              {any attributes with non-schema namespace . . .}>
              Content: (annotation? , (selector , field+))
            </keyref>
        */
        private static void InitIdentityConstraint(XsdBuilder builder, string value) {
            if (!builder.element.RefName.IsEmpty) {
                builder.SendValidationEvent(Res.Sch_ElementRef, null);
            }

            switch (builder.CurrentElement) {
                case SchemaNames.Token.XsdUnique:
                    builder.xso = builder.identityConstraint = new XmlSchemaUnique();
                    break;
                case SchemaNames.Token.XsdKey:
                    builder.xso = builder.identityConstraint = new XmlSchemaKey();
                    break;
                case SchemaNames.Token.XsdKeyref:
                    builder.xso = builder.identityConstraint = new XmlSchemaKeyref();
                    break;
            }
            builder.element.Constraints.Add(builder.identityConstraint);
        }
예제 #8
0
 //
 // Facets
 //
 /***
     <duration 
       id = ID 
       value = timeDuration 
       fixed = boolean : false>
       Content: (annotation?)
     </duration>
 ***/
 private static void InitFacet(XsdBuilder builder, string value) {
     switch (builder.CurrentElement) {
         case SchemaNames.ID.XSD_ENUMERATION:
             builder.facet = new XmlSchemaEnumerationFacet();
             break;
         case SchemaNames.ID.XSD_LENGTH:
             builder.facet = new XmlSchemaLengthFacet();
             break;
         case SchemaNames.ID.XSD_MAXEXCLUSIVE:
             builder.facet = new XmlSchemaMaxExclusiveFacet();
             break;
         case SchemaNames.ID.XSD_MAXINCLUSIVE:
             builder.facet = new XmlSchemaMaxInclusiveFacet();
             break;
         case SchemaNames.ID.XSD_MAXLENGTH:
             builder.facet = new XmlSchemaMaxLengthFacet();
             break;
         case SchemaNames.ID.XSD_MINEXCLUSIVE:
             builder.facet = new XmlSchemaMinExclusiveFacet();
             break;
         case SchemaNames.ID.XSD_MININCLUSIVE:
             builder.facet = new XmlSchemaMinInclusiveFacet();
             break;
         case SchemaNames.ID.XSD_MINLENGTH:
             builder.facet = new XmlSchemaMinLengthFacet();
             break;
         case SchemaNames.ID.XSD_PATTERN:
             builder.facet = new XmlSchemaPatternFacet();
             break;
         case SchemaNames.ID.XSD_TOTALDIGITS:
             builder.facet = new XmlSchemaTotalDigitsFacet();
             break;
         case SchemaNames.ID.XSD_FRACTIONDIGITS:
             builder.facet = new XmlSchemaFractionDigitsFacet();
             break;
         case SchemaNames.ID.XSD_WHITESPACE:
             builder.facet = new XmlSchemaWhiteSpaceFacet();
             break;
     }
     builder.xso = builder.facet;
     if (SchemaNames.ID.XSD_SIMPLETYPERESTRICTION == builder.ParentElement) {
         builder.simpleTypeRestriction.Facets.Add(builder.facet);
     }
     else {
         if (builder.simpleContentRestriction.Attributes.Count != 0 || (builder.simpleContentRestriction.AnyAttribute != null)) {
             builder.SendValidationEvent(Res.Sch_InvalidFacetPosition, null);
         }
         builder.simpleContentRestriction.Facets.Add(builder.facet);
     }
 }
예제 #9
0
 /***
     <annotation>
       Content: (appinfo | documentation)*
     </annotation>
 ***/
 private static void InitAnnotation(XsdBuilder builder, string value) {
     if (builder.hasChild && builder.ParentElement != SchemaNames.ID.XSD_SCHEMA) {
         builder.SendValidationEvent(Res.Sch_AnnotationLocation, null);
     }
     builder.xso = builder.annotation = new XmlSchemaAnnotation();
     builder.ParentContainer.AddAnnotation(builder.annotation);
 }
예제 #10
0
        /***
            <simpleType 
              id = ID 
              name = NCName 
              {any attributes with non-schema namespace . . .}>
              Content: (annotation? , ((list | restriction | union)))
            </simpleType>
        ***/
        private static void InitSimpleType(XsdBuilder builder, string value) {
            builder.xso = builder.simpleType = new XmlSchemaSimpleType();
            switch (builder.ParentElement) {
                case SchemaNames.ID.XSD_SCHEMA:
                    builder.canIncludeImport = false;  // disable import and include elements in schema
                    builder.schema.Items.Add(builder.simpleType);                    
                    break;
                case SchemaNames.ID.XSD_REDEFINE:
                    builder.redefine.Items.Add(builder.simpleType);                    
                    break;
                case SchemaNames.ID.XSD_ATTRIBUTE:
                    if (builder.attribute.SchemaType != null) {
                        builder.SendValidationEvent(Res.Sch_DupXsdElement, "simpleType");
                    }
                    builder.attribute.SchemaType = builder.simpleType;
                    break;
                case SchemaNames.ID.XSD_ELEMENT:
                    if (builder.element.SchemaType != null) {
                        builder.SendValidationEvent(Res.Sch_DupXsdElement, "simpleType");
                    }
                    if (builder.element.Constraints.Count != 0) {
                        builder.SendValidationEvent(Res.Sch_TypeAfterConstraints, null);
                    }
                    builder.element.SchemaType = builder.simpleType;
                    break;
                case SchemaNames.ID.XSD_SIMPLETYPELIST:
                    if (builder.simpleTypeList.ItemType != null) {
                        builder.SendValidationEvent(Res.Sch_DupXsdElement, "simpleType");
                    }
                    builder.simpleTypeList.ItemType = builder.simpleType;
                    break;
                case SchemaNames.ID.XSD_SIMPLETYPERESTRICTION:
                    if (builder.simpleTypeRestriction.BaseType != null) {
                        builder.SendValidationEvent(Res.Sch_DupXsdElement, "simpleType");
                    }
                    builder.simpleTypeRestriction.BaseType = builder.simpleType;
                    break;
                case SchemaNames.ID.XSD_SIMPLECONTENTRESTRICTION:
                    if (builder.simpleContentRestriction.BaseType != null) {
                        builder.SendValidationEvent(Res.Sch_DupXsdElement, "simpleType");
                    }
                    if (
                        builder.simpleContentRestriction.Attributes.Count != 0 || 
                        builder.simpleContentRestriction.AnyAttribute != null || 
                        builder.simpleContentRestriction.Facets.Count != 0
                    ) {
                        builder.SendValidationEvent(Res.Sch_SimpleTypeRestriction, null);
                    }
                    builder.simpleContentRestriction.BaseType = builder.simpleType;
                    break;

                case SchemaNames.ID.XSD_SIMPLETYPEUNION:
                    builder.simpleTypeUnion.BaseTypes.Add(builder.simpleType);  
                    break;
            }
        }
예제 #11
0
 /***
     <anyAttribute 
       id = ID 
       namespace = ##any | ##other | list of {uri, ##targetNamespace, ##local} : ##any
       processContents = skip | lax | strict : strict
       {any attributes with non-schema namespace . . .}>
       Content: (annotation?)
     </anyAttribute>
 ***/
 private static void InitAnyAttribute(XsdBuilder builder, string value) {
     builder.xso = builder.anyAttribute = new XmlSchemaAnyAttribute();
     switch (builder.ParentElement) {
         case SchemaNames.ID.XSD_COMPLEXTYPE:
             if (builder.complexType.ContentModel != null) {
                 builder.SendValidationEvent(Res.Sch_AttributeMutuallyExclusive, "anyAttribute");
             }
             if (builder.complexType.AnyAttribute != null) {
                 builder.SendValidationEvent(Res.Sch_DupElement, "anyAttribute");
             }
             builder.complexType.AnyAttribute = builder.anyAttribute;
             break;
         case SchemaNames.ID.XSD_SIMPLECONTENTRESTRICTION:
             if (builder.simpleContentRestriction.AnyAttribute != null) {
                 builder.SendValidationEvent(Res.Sch_DupElement, "anyAttribute");
             }
             builder.simpleContentRestriction.AnyAttribute = builder.anyAttribute;
             break;
         case SchemaNames.ID.XSD_SIMPLECONTENTEXTENSION:
             if (builder.simpleContentExtension.AnyAttribute != null) {
                 builder.SendValidationEvent(Res.Sch_DupElement, "anyAttribute");
             }
             builder.simpleContentExtension.AnyAttribute = builder.anyAttribute;
             break;
         case SchemaNames.ID.XSD_COMPLEXCONTENTEXTENSION:
             if (builder.complexContentExtension.AnyAttribute != null) {
                 builder.SendValidationEvent(Res.Sch_DupElement, "anyAttribute");
             }
             builder.complexContentExtension.AnyAttribute = builder.anyAttribute;
             break;
         case SchemaNames.ID.XSD_COMPLEXCONTENTRESTRICTION:
             if (builder.complexContentRestriction.AnyAttribute != null) {
                 builder.SendValidationEvent(Res.Sch_DupElement, "anyAttribute");
             }
             builder.complexContentRestriction.AnyAttribute = builder.anyAttribute;
             break;
         case SchemaNames.ID.XSD_ATTRIBUTEGROUP:
             if (builder.attributeGroup.AnyAttribute != null) {
                 builder.SendValidationEvent(Res.Sch_DupElement, "anyAttribute");
             }
             builder.attributeGroup.AnyAttribute = builder.anyAttribute;
             break;
     }
 }
예제 #12
0
파일: XsdBuilder.cs 프로젝트: dotnet/corefx
 /*
     <list 
       id = ID 
       itemType = QName 
       {any attributes with non-schema namespace . . .}>
       Content: (annotation? , (simpleType?))
     </list>
 */
 private static void InitSimpleTypeList(XsdBuilder builder, string value)
 {
     if (builder._simpleType.Content != null)
     {
         builder.SendValidationEvent(SR.Sch_DupSimpleTypeChild, null);
     }
     builder._xso = builder._simpleTypeList = new XmlSchemaSimpleTypeList();
     builder._simpleType.Content = builder._simpleTypeList;
 }
예제 #13
0
파일: XsdBuilder.cs 프로젝트: dotnet/corefx
 /*
     <include 
       id = ID 
       schemaLocation = uriReference 
       {any attributes with non-schema namespace . . .}>
       Content: (annotation?)
     </include>
 */
 private static void InitInclude(XsdBuilder builder, string value)
 {
     if (!builder._canIncludeImport)
     {
         builder.SendValidationEvent(SR.Sch_IncludeLocation, null);
     }
     builder._xso = builder._include = new XmlSchemaInclude();
     builder._schema.Includes.Add(builder._include);
 }
 private static void InitComplexContent(XsdBuilder builder, string value)
 {
     if (((builder.complexType.ContentModel != null) || (builder.complexType.Particle != null)) || ((builder.complexType.Attributes.Count != 0) || (builder.complexType.AnyAttribute != null)))
     {
         builder.SendValidationEvent("Sch_ComplexTypeContentModel", "complexContent");
     }
     builder.xso = builder.complexContent = new XmlSchemaComplexContent();
     builder.complexType.ContentModel = builder.complexContent;
 }
예제 #15
0
 /*
     <simpleContent 
       id = ID 
       {any attributes with non-schema namespace . . .}>
       Content: (annotation? , (restriction | extension))
     </simpleContent>
 */
 private static void InitSimpleContent(XsdBuilder builder, string value) {
     if ( (builder.complexType.ContentModel != null) || 
          (builder.complexType.Particle != null || builder.complexType.Attributes.Count != 0 || builder.complexType.AnyAttribute != null)
          ) {
            builder.SendValidationEvent(Res.Sch_ComplexTypeContentModel, "simpleContent");
     }
     builder.xso = builder.simpleContent = new XmlSchemaSimpleContent();
     builder.complexType.ContentModel = builder.simpleContent;
 }
예제 #16
0
 /*
     <import 
       id = ID 
       namespace = uriReference 
       schemaLocation = uriReference 
       {any attributes with non-schema namespace . . .}>
       Content: (annotation?)
     </import>
 */
 private static void InitImport(XsdBuilder builder, string value) {
     if (!builder.canIncludeImport) {
         builder.SendValidationEvent(Res.Sch_ImportLocation, null);            
     }
     builder.xso = builder.import = new XmlSchemaImport();
     builder.schema.Includes.Add(builder.import);
 }
예제 #17
0
 /*
     <restriction 
       base = QName 
       id = ID 
       {any attributes with non-schema namespace . . .}>
       Content: (annotation? , ((duration | encoding | enumeration | length | maxExclusive | maxInclusive | maxLength | minExclusive | minInclusive | minLength | pattern | period | totalDigits | fractionDigits)*)? , ((attribute | attributeGroup)* , anyAttribute?))
     </restriction>
 */
 private static void InitSimpleContentRestriction(XsdBuilder builder, string value) {
     if (builder.simpleContent.Content != null) {
         builder.SendValidationEvent(Res.Sch_DupElement, "restriction");
     }
     builder.xso = builder.simpleContentRestriction = new XmlSchemaSimpleContentRestriction();
     builder.simpleContent.Content = builder.simpleContentRestriction;
 }
예제 #18
0
 /*
     <redefine 
       schemaLocation = uriReference 
       {any attributes with non-schema namespace . . .}>
       Content: (annotation | (attributeGroup | complexType | group | simpleType))*
     </redefine>
 */
 private static void InitRedefine(XsdBuilder builder, string value) {
     if (!builder.canIncludeImport) {
         builder.SendValidationEvent(Res.Sch_RedefineLocation, null);            
     }
     builder.xso = builder.redefine = new XmlSchemaRedefine();
     builder.schema.Includes.Add(builder.redefine);
 }
예제 #19
0
 //
 // Facets
 //
 /*
     <duration 
       id = ID 
       value = timeDuration 
       fixed = boolean : false>
       Content: (annotation?)
     </duration>
 */
 private static void InitFacet(XsdBuilder builder, string value) {
     switch (builder.CurrentElement) {
         case SchemaNames.Token.XsdEnumeration:
             builder.facet = new XmlSchemaEnumerationFacet();
             break;
         case SchemaNames.Token.XsdLength:
             builder.facet = new XmlSchemaLengthFacet();
             break;
         case SchemaNames.Token.XsdMaxExclusive:
             builder.facet = new XmlSchemaMaxExclusiveFacet();
             break;
         case SchemaNames.Token.XsdMaxInclusive:
             builder.facet = new XmlSchemaMaxInclusiveFacet();
             break;
         case SchemaNames.Token.XsdMaxLength:
             builder.facet = new XmlSchemaMaxLengthFacet();
             break;
         case SchemaNames.Token.XsdMinExclusive:
             builder.facet = new XmlSchemaMinExclusiveFacet();
             break;
         case SchemaNames.Token.XsdMinInclusive:
             builder.facet = new XmlSchemaMinInclusiveFacet();
             break;
         case SchemaNames.Token.XsdMinLength:
             builder.facet = new XmlSchemaMinLengthFacet();
             break;
         case SchemaNames.Token.XsdPattern:
             builder.facet = new XmlSchemaPatternFacet();
             break;
         case SchemaNames.Token.XsdTotalDigits:
             builder.facet = new XmlSchemaTotalDigitsFacet();
             break;
         case SchemaNames.Token.XsdFractionDigits:
             builder.facet = new XmlSchemaFractionDigitsFacet();
             break;
         case SchemaNames.Token.XsdWhitespace:
             builder.facet = new XmlSchemaWhiteSpaceFacet();
             break;
     }
     builder.xso = builder.facet;
     if (SchemaNames.Token.XsdSimpleTypeRestriction == builder.ParentElement) {
         builder.simpleTypeRestriction.Facets.Add(builder.facet);
     }
     else {
         if (builder.simpleContentRestriction.Attributes.Count != 0 || (builder.simpleContentRestriction.AnyAttribute != null)) {
             builder.SendValidationEvent(Res.Sch_InvalidFacetPosition, null);
         }
         builder.simpleContentRestriction.Facets.Add(builder.facet);
     }
 }
예제 #20
0
        /*
            <simpleType 
              id = ID 
              name = NCName 
              {any attributes with non-schema namespace . . .}>
              Content: (annotation? , ((list | restriction | union)))
            </simpleType>
        */
        private static void InitSimpleType(XsdBuilder builder, string value) {
            builder.xso = builder.simpleType = new XmlSchemaSimpleType();
            switch (builder.ParentElement) {
                case SchemaNames.Token.XsdSchema:
                    builder.canIncludeImport = false;  // disable import and include elements in schema
                    builder.schema.Items.Add(builder.simpleType);                    
                    break;
                case SchemaNames.Token.XsdRedefine:
                    builder.redefine.Items.Add(builder.simpleType);                    
                    break;
                case SchemaNames.Token.XsdAttribute:
                    if (builder.attribute.SchemaType != null) {
                        builder.SendValidationEvent(Res.Sch_DupXsdElement, "simpleType");
                    }
                    builder.attribute.SchemaType = builder.simpleType;
                    break;
                case SchemaNames.Token.XsdElement:
                    if (builder.element.SchemaType != null) {
                        builder.SendValidationEvent(Res.Sch_DupXsdElement, "simpleType");
                    }
                    if (builder.element.Constraints.Count != 0) {
                        builder.SendValidationEvent(Res.Sch_TypeAfterConstraints, null);
                    }
                    builder.element.SchemaType = builder.simpleType;
                    break;
                case SchemaNames.Token.XsdSimpleTypeList:
                    if (builder.simpleTypeList.ItemType != null) {
                        builder.SendValidationEvent(Res.Sch_DupXsdElement, "simpleType");
                    }
                    builder.simpleTypeList.ItemType = builder.simpleType;
                    break;
                case SchemaNames.Token.XsdSimpleTypeRestriction:
                    if (builder.simpleTypeRestriction.BaseType != null) {
                        builder.SendValidationEvent(Res.Sch_DupXsdElement, "simpleType");
                    }
                    builder.simpleTypeRestriction.BaseType = builder.simpleType;
                    break;
                case SchemaNames.Token.XsdSimpleContentRestriction:
                    if (builder.simpleContentRestriction.BaseType != null) {
                        builder.SendValidationEvent(Res.Sch_DupXsdElement, "simpleType");
                    }
                    if (
                        builder.simpleContentRestriction.Attributes.Count != 0 || 
                        builder.simpleContentRestriction.AnyAttribute != null || 
                        builder.simpleContentRestriction.Facets.Count != 0
                    ) {
                        builder.SendValidationEvent(Res.Sch_SimpleTypeRestriction, null);
                    }
                    builder.simpleContentRestriction.BaseType = builder.simpleType;
                    break;

                case SchemaNames.Token.XsdSimpleTypeUnion:
                    builder.simpleTypeUnion.BaseTypes.Add(builder.simpleType);  
                    break;
            }
        }
예제 #21
0
 private static void BuildIdentityConstraint_Refer(XsdBuilder builder, string value) {
     if (builder.identityConstraint is XmlSchemaKeyref) {
         ((XmlSchemaKeyref)builder.identityConstraint).Refer = builder.ParseQName(value, "refer");
     }
     else {
         builder.SendValidationEvent(Res.Sch_UnsupportedAttribute, "refer");
     }
 } 
예제 #22
0
 private static void BuildSimpleTypeUnion_MemberTypes(XsdBuilder builder, string value) {
     XmlSchemaDatatype dt = XmlSchemaDatatype.FromXmlTokenizedTypeXsd(XmlTokenizedType.QName).DeriveByList(null);
     try {
         builder.simpleTypeUnion.MemberTypes = (XmlQualifiedName[])dt.ParseValue(value, builder.nameTable, builder.namespaceManager);
     } 
     catch (XmlSchemaException e) {
         e.SetSource(builder.reader.BaseURI, builder.positionInfo.LineNumber, builder.positionInfo.LinePosition);
         builder.SendValidationEvent(e);
     }
 }
예제 #23
0
 /*
     <field 
       id = ID 
       xpath = An XPath expression 
       {any attributes with non-schema namespace . . .}>
       Content: (annotation?)
     </field>
 */
 private static void InitField(XsdBuilder builder, string value) {
     builder.xso = builder.xpath = new XmlSchemaXPath();
     // no selector before fields?
     if ( builder.identityConstraint.Selector == null ) {
         builder.SendValidationEvent(Res.Sch_SelectorBeforeFields, builder.identityConstraint.Name);
     }
     builder.identityConstraint.Fields.Add(builder.xpath);
 }
예제 #24
0
 /*
     <restriction 
       base = QName 
       id = ID 
       {any attributes with non-schema namespace . . .}>
       Content: (annotation? , (simpleType? , ((duration | encoding | enumeration | length | maxExclusive | maxInclusive | maxLength | minExclusive | minInclusive | minLength | pattern | period | TotalDigits | FractionDigits)*)))
     </restriction>
 */
 private static void InitSimpleTypeRestriction(XsdBuilder builder, string value) {
     if (builder.simpleType.Content != null) {
         builder.SendValidationEvent(Res.Sch_DupSimpleTypeChild, null);
     }
     builder.xso = builder.simpleTypeRestriction = new XmlSchemaSimpleTypeRestriction();
     builder.simpleType.Content = builder.simpleTypeRestriction;
 }
예제 #25
0
 private static void BuildDocumentation_XmlLang(XsdBuilder builder, string value) {
     try {
         builder.documentation.Language = value;
     } 
     catch (XmlSchemaException e) {
         e.SetSource(builder.reader.BaseURI, builder.positionInfo.LineNumber, builder.positionInfo.LinePosition);
         builder.SendValidationEvent(e);
     }
 }
        private static void InitSimpleType(XsdBuilder builder, string value)
        {
            builder.xso = builder.simpleType = new XmlSchemaSimpleType();
            switch (builder.ParentElement)
            {
                case SchemaNames.Token.XsdElement:
                    if (builder.element.SchemaType != null)
                    {
                        builder.SendValidationEvent("Sch_DupXsdElement", "simpleType");
                    }
                    if (builder.element.Constraints.Count != 0)
                    {
                        builder.SendValidationEvent("Sch_TypeAfterConstraints", null);
                    }
                    builder.element.SchemaType = builder.simpleType;
                    return;

                case SchemaNames.Token.XsdAttribute:
                    if (builder.attribute.SchemaType != null)
                    {
                        builder.SendValidationEvent("Sch_DupXsdElement", "simpleType");
                    }
                    builder.attribute.SchemaType = builder.simpleType;
                    return;

                case SchemaNames.Token.XsdSchema:
                    builder.canIncludeImport = false;
                    builder.schema.Items.Add(builder.simpleType);
                    return;

                case SchemaNames.Token.XsdSimpleContentRestriction:
                    if (builder.simpleContentRestriction.BaseType != null)
                    {
                        builder.SendValidationEvent("Sch_DupXsdElement", "simpleType");
                    }
                    if (((builder.simpleContentRestriction.Attributes.Count != 0) || (builder.simpleContentRestriction.AnyAttribute != null)) || (builder.simpleContentRestriction.Facets.Count != 0))
                    {
                        builder.SendValidationEvent("Sch_SimpleTypeRestriction", null);
                    }
                    builder.simpleContentRestriction.BaseType = builder.simpleType;
                    return;

                case SchemaNames.Token.XsdSimpleTypeList:
                    if (builder.simpleTypeList.ItemType != null)
                    {
                        builder.SendValidationEvent("Sch_DupXsdElement", "simpleType");
                    }
                    builder.simpleTypeList.ItemType = builder.simpleType;
                    return;

                case SchemaNames.Token.XsdSimpleTypeRestriction:
                    if (builder.simpleTypeRestriction.BaseType != null)
                    {
                        builder.SendValidationEvent("Sch_DupXsdElement", "simpleType");
                    }
                    builder.simpleTypeRestriction.BaseType = builder.simpleType;
                    return;

                case SchemaNames.Token.XsdSimpleTypeUnion:
                    builder.simpleTypeUnion.BaseTypes.Add(builder.simpleType);
                    break;

                case SchemaNames.Token.XsdWhitespace:
                    break;

                case SchemaNames.Token.XsdRedefine:
                    builder.redefine.Items.Add(builder.simpleType);
                    return;

                default:
                    return;
            }
        }