本文整理汇总了C#中System.Xml.Schema.XsdBuilder.SendValidationEvent方法的典型用法代码示例。如果您正苦于以下问题:C# XsdBuilder.SendValidationEvent方法的具体用法?C# XsdBuilder.SendValidationEvent怎么用?C# XsdBuilder.SendValidationEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.Schema.XsdBuilder
的用法示例。
在下文中一共展示了XsdBuilder.SendValidationEvent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitComplexContentExtension
/*
<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;
}
示例2: InitAnnotation
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: or
/*
<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: InitSelector
/*
<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: InitAnnotation
/*
<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: InitAnyAttribute
/*
<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: InitIdentityConstraint
/*
<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: InitFacet
//
// 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: InitAnnotation
/***
<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: InitSimpleType
/***
<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: InitAnyAttribute
/***
<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: InitSimpleTypeList
/*
<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: InitInclude
/*
<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);
}
示例14: InitComplexContent
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: InitSimpleContent
/*
<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;
}