本文整理汇总了C#中XmlSchemaDatatype类的典型用法代码示例。如果您正苦于以下问题:C# XmlSchemaDatatype类的具体用法?C# XmlSchemaDatatype怎么用?C# XmlSchemaDatatype使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlSchemaDatatype类属于命名空间,在下文中一共展示了XmlSchemaDatatype类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CheckValueFacets
internal override Exception CheckValueFacets(XmlQualifiedName value, XmlSchemaDatatype datatype)
{
RestrictionFacets restriction = datatype.Restriction;
RestrictionFlags flags = (restriction != null) ? restriction.Flags : ((RestrictionFlags) 0);
if (flags != 0)
{
int length = value.ToString().Length;
if (((flags & RestrictionFlags.Length) != 0) && (restriction.Length != length))
{
return new XmlSchemaException("Sch_LengthConstraintFailed", string.Empty);
}
if (((flags & RestrictionFlags.MinLength) != 0) && (length < restriction.MinLength))
{
return new XmlSchemaException("Sch_MinLengthConstraintFailed", string.Empty);
}
if (((flags & RestrictionFlags.MaxLength) != 0) && (restriction.MaxLength < length))
{
return new XmlSchemaException("Sch_MaxLengthConstraintFailed", string.Empty);
}
if (((flags & RestrictionFlags.Enumeration) != 0) && !this.MatchEnumeration(value, restriction.Enumeration))
{
return new XmlSchemaException("Sch_EnumerationConstraintFailed", string.Empty);
}
}
return null;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:QNameFacetsChecker.cs
示例2: IsDerivedFrom
public virtual bool IsDerivedFrom (XmlSchemaDatatype datatype)
{
// It is documented to return always false, but
// actually returns true when the argument is for
// the same type (and it does not check null argument).
return this == datatype;
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:7,代码来源:XmlSchemaDatatype.cs
示例3: CheckValueFacets
internal override Exception CheckValueFacets(decimal value, XmlSchemaDatatype datatype)
{
RestrictionFacets restriction = datatype.Restriction;
RestrictionFlags flags = (restriction != null) ? restriction.Flags : ((RestrictionFlags) 0);
XmlValueConverter valueConverter = datatype.ValueConverter;
if ((value > this.maxValue) || (value < this.minValue))
{
return new OverflowException(Res.GetString("XmlConvert_Overflow", new object[] { value.ToString(CultureInfo.InvariantCulture), datatype.TypeCodeString }));
}
if (flags == 0)
{
return null;
}
if (((flags & RestrictionFlags.MaxInclusive) != 0) && (value > valueConverter.ToDecimal(restriction.MaxInclusive)))
{
return new XmlSchemaException("Sch_MaxInclusiveConstraintFailed", string.Empty);
}
if (((flags & RestrictionFlags.MaxExclusive) != 0) && (value >= valueConverter.ToDecimal(restriction.MaxExclusive)))
{
return new XmlSchemaException("Sch_MaxExclusiveConstraintFailed", string.Empty);
}
if (((flags & RestrictionFlags.MinInclusive) != 0) && (value < valueConverter.ToDecimal(restriction.MinInclusive)))
{
return new XmlSchemaException("Sch_MinInclusiveConstraintFailed", string.Empty);
}
if (((flags & RestrictionFlags.MinExclusive) != 0) && (value <= valueConverter.ToDecimal(restriction.MinExclusive)))
{
return new XmlSchemaException("Sch_MinExclusiveConstraintFailed", string.Empty);
}
if (((flags & RestrictionFlags.Enumeration) != 0) && !this.MatchEnumeration(value, restriction.Enumeration, valueConverter))
{
return new XmlSchemaException("Sch_EnumerationConstraintFailed", string.Empty);
}
return this.CheckTotalAndFractionDigits(value, restriction.TotalDigits, restriction.FractionDigits, (flags & RestrictionFlags.TotalDigits) != 0, (flags & RestrictionFlags.FractionDigits) != 0);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:35,代码来源:Numeric10FacetsChecker.cs
示例4: SchemaElementDecl
internal SchemaElementDecl(XmlSchemaDatatype dtype)
{
this.attdefs = new Dictionary<XmlQualifiedName, SchemaAttDef>();
this.prohibitedAttributes = new Dictionary<XmlQualifiedName, XmlQualifiedName>();
base.Datatype = dtype;
this.contentValidator = System.Xml.Schema.ContentValidator.TextOnly;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:SchemaElementDecl.cs
示例5: CheckValueFacets
internal Exception CheckValueFacets(string value, XmlSchemaDatatype datatype, bool verifyUri)
{
int length = value.Length;
RestrictionFacets restriction = datatype.Restriction;
RestrictionFlags flags = (restriction != null) ? restriction.Flags : ((RestrictionFlags) 0);
Exception exception = this.CheckBuiltInFacets(value, datatype.TypeCode, verifyUri);
if (exception != null)
{
return exception;
}
if (flags != 0)
{
if (((flags & RestrictionFlags.Length) != 0) && (restriction.Length != length))
{
return new XmlSchemaException("Sch_LengthConstraintFailed", string.Empty);
}
if (((flags & RestrictionFlags.MinLength) != 0) && (length < restriction.MinLength))
{
return new XmlSchemaException("Sch_MinLengthConstraintFailed", string.Empty);
}
if (((flags & RestrictionFlags.MaxLength) != 0) && (restriction.MaxLength < length))
{
return new XmlSchemaException("Sch_MaxLengthConstraintFailed", string.Empty);
}
if (((flags & RestrictionFlags.Enumeration) != 0) && !this.MatchEnumeration(value, restriction.Enumeration, datatype))
{
return new XmlSchemaException("Sch_EnumerationConstraintFailed", string.Empty);
}
}
return null;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:31,代码来源:StringFacetsChecker.cs
示例6: IsComparable
internal override bool IsComparable(XmlSchemaDatatype dtype) {
XmlTypeCode thisCode = this.TypeCode;
XmlTypeCode otherCode = dtype.TypeCode;
if (thisCode == otherCode) { //They are both same built-in type or one is list and the other is list's itemType
return true;
}
if (GetPrimitiveTypeCode(thisCode) == GetPrimitiveTypeCode(otherCode)) {
return true;
}
if (this.IsDerivedFrom(dtype) || dtype.IsDerivedFrom(this)) { //One is union and the other is a member of the union
return true;
}
return false;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:15,代码来源:DataTypeImplementation.cs
示例7: StartBuiltinType
/// <summary>
/// Begin the creation of an XmlSchemaSimpleType object that will be used to represent a static built-in type.
/// Once StartBuiltinType has been called for all built-in types, FinishBuiltinType should be called in order
/// to create links between the types.
/// </summary>
internal static XmlSchemaSimpleType StartBuiltinType(XmlQualifiedName qname, XmlSchemaDatatype dataType) {
XmlSchemaSimpleType simpleType;
Debug.Assert(qname != null && dataType != null);
simpleType = new XmlSchemaSimpleType();
simpleType.SetQualifiedName(qname);
simpleType.SetDatatype(dataType);
simpleType.ElementDecl = new SchemaElementDecl(dataType);
simpleType.ElementDecl.SchemaType = simpleType;
return simpleType;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:17,代码来源:DataTypeImplementation.cs
示例8: IsDerivedFrom
/// <include file='doc\XmlSchemaDatatype.uex' path='docs/doc[@for="XmlSchemaDatatype.IsDerivedFrom"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public virtual bool IsDerivedFrom(XmlSchemaDatatype datatype)
{
return false;
}
开发者ID:geoffkizer,项目名称:corefx,代码行数:8,代码来源:XmlSchemaDataType.cs
示例9: EndElementIdentityConstraints
private void EndElementIdentityConstraints(object typedValue, string stringValue, XmlSchemaDatatype datatype)
{
string localName = this.context.LocalName;
string uRN = this.context.Namespace;
for (int i = this.validationStack.Length - 1; i >= this.startIDConstraint; i--)
{
if (((ValidationState) this.validationStack[i]).Constr != null)
{
ConstraintStruct[] structArray = ((ValidationState) this.validationStack[i]).Constr;
for (int j = 0; j < structArray.Length; j++)
{
KeySequence sequence;
for (int k = 0; k < structArray[j].axisFields.Count; k++)
{
LocatedActiveAxis axis = (LocatedActiveAxis) structArray[j].axisFields[k];
if (axis.isMatched)
{
axis.isMatched = false;
if (axis.Ks[axis.Column] != null)
{
this.SendValidationEvent("Sch_FieldSingleValueExpected", localName);
}
else if ((typedValue != null) && (stringValue.Length != 0))
{
axis.Ks[axis.Column] = new TypedObject(typedValue, stringValue, datatype);
}
}
axis.EndElement(localName, uRN);
}
if (structArray[j].axisSelector.EndElement(localName, uRN))
{
sequence = structArray[j].axisSelector.PopKS();
switch (structArray[j].constraint.Role)
{
case CompiledIdentityConstraint.ConstraintRole.Unique:
if (sequence.IsQualified())
{
if (!structArray[j].qualifiedTable.Contains(sequence))
{
goto Label_0283;
}
this.SendValidationEvent(new XmlSchemaValidationException("Sch_DuplicateKey", new string[] { sequence.ToString(), structArray[j].constraint.name.ToString() }, this.sourceUriString, sequence.PosLine, sequence.PosCol));
}
break;
case CompiledIdentityConstraint.ConstraintRole.Key:
if (sequence.IsQualified())
{
goto Label_0195;
}
this.SendValidationEvent(new XmlSchemaValidationException("Sch_MissingKey", structArray[j].constraint.name.ToString(), this.sourceUriString, sequence.PosLine, sequence.PosCol));
break;
case CompiledIdentityConstraint.ConstraintRole.Keyref:
if (((structArray[j].qualifiedTable != null) && sequence.IsQualified()) && !structArray[j].qualifiedTable.Contains(sequence))
{
structArray[j].qualifiedTable.Add(sequence, sequence);
}
break;
}
}
continue;
Label_0195:
if (structArray[j].qualifiedTable.Contains(sequence))
{
this.SendValidationEvent(new XmlSchemaValidationException("Sch_DuplicateKey", new string[] { sequence.ToString(), structArray[j].constraint.name.ToString() }, this.sourceUriString, sequence.PosLine, sequence.PosCol));
}
else
{
structArray[j].qualifiedTable.Add(sequence, sequence);
}
continue;
Label_0283:
structArray[j].qualifiedTable.Add(sequence, sequence);
}
}
}
ConstraintStruct[] constr = ((ValidationState) this.validationStack[this.validationStack.Length - 1]).Constr;
if (constr != null)
{
for (int m = 0; m < constr.Length; m++)
{
if ((constr[m].constraint.Role != CompiledIdentityConstraint.ConstraintRole.Keyref) && (constr[m].keyrefTable != null))
{
foreach (KeySequence sequence2 in constr[m].keyrefTable.Keys)
{
if (!constr[m].qualifiedTable.Contains(sequence2))
{
this.SendValidationEvent(new XmlSchemaValidationException("Sch_UnresolvedKeyref", sequence2.ToString(), this.sourceUriString, sequence2.PosLine, sequence2.PosCol));
}
}
}
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:95,代码来源:XmlSchemaValidator.cs
示例10: AttributeIdentityConstraints
private void AttributeIdentityConstraints(string name, string ns, object obj, string sobj, XmlSchemaDatatype datatype)
{
for (int i = this.startIDConstraint; i < this.validationStack.Length; i++)
{
if (((ValidationState) this.validationStack[i]).Constr != null)
{
ConstraintStruct[] constr = ((ValidationState) this.validationStack[i]).Constr;
for (int j = 0; j < constr.Length; j++)
{
for (int k = 0; k < constr[j].axisFields.Count; k++)
{
LocatedActiveAxis axis = (LocatedActiveAxis) constr[j].axisFields[k];
if (axis.MoveToAttribute(name, ns))
{
if (axis.Ks[axis.Column] != null)
{
this.SendValidationEvent("Sch_FieldSingleValueExpected", name);
}
else
{
axis.Ks[axis.Column] = new TypedObject(obj, sobj, datatype);
}
}
}
}
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:XmlSchemaValidator.cs
示例11: MatchEnumeration
internal override bool MatchEnumeration(object value, ArrayList enumeration, XmlSchemaDatatype datatype)
{
return MatchEnumeration((string)datatype.ChangeType(value, XTypedServices.typeOfString), enumeration, datatype);
}
开发者ID:alcardac,项目名称:SDMXRI_WS_OF,代码行数:4,代码来源:FacetChecker.cs
示例12: ConvertDatatype
private Type ConvertDatatype (XmlSchemaDatatype dt)
{
if (dt == null)
return typeof (string);
else if (dt.ValueType == typeof (decimal)) {
// LAMESPEC: MSDN documentation says it is based
// on ValueType. However, in the System.Xml.Schema
// context, xs:integer is mapped to Decimal, while
// in DataSet context it is mapped to Int64.
if (dt == schemaDecimalType)
return typeof (decimal);
else if (dt == schemaIntegerType)
return typeof (long);
else
return typeof (ulong);
}
else
return dt.ValueType;
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:19,代码来源:XmlSchemaDataImporter.cs
示例13: XmlSchemaDataImporter
static XmlSchemaDataImporter ()
{
XmlSchema s = new XmlSchema ();
XmlSchemaAttribute a = new XmlSchemaAttribute ();
a.Name = "foo";
a.SchemaTypeName = new XmlQualifiedName ("integer", XmlSchema.Namespace);
s.Items.Add (a);
XmlSchemaAttribute b = new XmlSchemaAttribute ();
b.Name = "bar";
b.SchemaTypeName = new XmlQualifiedName ("decimal", XmlSchema.Namespace);
s.Items.Add (b);
XmlSchemaElement e = new XmlSchemaElement ();
e.Name = "bar";
s.Items.Add (e);
s.Compile (null);
schemaIntegerType = a.AttributeType as XmlSchemaDatatype;
schemaDecimalType = b.AttributeType as XmlSchemaDatatype;
schemaAnyType = e.ElementType as XmlSchemaComplexType;
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:19,代码来源:XmlSchemaDataImporter.cs
示例14: SetListElement
protected void SetListElement(XName name,
object value,
XmlSchemaDatatype datatype)
{
SetElement(name, ListSimpleTypeValidator.ToString(value), datatype);
}
开发者ID:dipdapdop,项目名称:linqtoxsd,代码行数:6,代码来源:XObjectsSimpleType.cs
示例15: CheckTokenizedTypes
private void CheckTokenizedTypes(XmlSchemaDatatype dtype, object typedValue, bool attrValue)
{
if (typedValue != null)
{
switch (dtype.TokenizedType)
{
case XmlTokenizedType.ENTITY:
case XmlTokenizedType.ID:
case XmlTokenizedType.IDREF:
if (dtype.Variety == XmlSchemaDatatypeVariety.List)
{
string[] strArray = (string[]) typedValue;
for (int i = 0; i < strArray.Length; i++)
{
this.ProcessTokenizedType(dtype.TokenizedType, strArray[i], attrValue);
}
return;
}
this.ProcessTokenizedType(dtype.TokenizedType, (string) typedValue, attrValue);
break;
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:23,代码来源:XmlSchemaValidator.cs
示例16: IsComparable
internal abstract bool IsComparable(XmlSchemaDatatype dtype);
开发者ID:geoffkizer,项目名称:corefx,代码行数:1,代码来源:XmlSchemaDataType.cs
示例17: SetVariety
private void SetVariety(XmlSchemaDatatype datatype) {
XmlSchemaDatatypeVariety variety = datatype.Variety;
if (variety == XmlSchemaDatatypeVariety.List) {
typeRefFlags |= ClrTypeRefFlags.IsSchemaList;
}
else if (variety == XmlSchemaDatatypeVariety.Union) {
typeRefFlags |= ClrTypeRefFlags.IsUnion;
}
}
开发者ID:pusp,项目名称:o2platform,代码行数:9,代码来源:ClrTypeInfo.cs
示例18: IsDerivedFrom
public override bool IsDerivedFrom(XmlSchemaDatatype datatype) {
if (datatype == null) {
return false;
}
//Common case - Derived by restriction
for(DatatypeImplementation dt = this; dt != null; dt = dt.baseType) {
if (dt == datatype) {
return true;
}
}
if (((DatatypeImplementation)datatype).baseType == null) { //Both are built-in types
Type derivedType = this.GetType();
Type baseType = datatype.GetType();
return baseType == derivedType || derivedType.IsSubclassOf(baseType);
}
else if (datatype.Variety == XmlSchemaDatatypeVariety.Union && !datatype.HasLexicalFacets && !datatype.HasValueFacets && variety != XmlSchemaDatatypeVariety.Union) { //base type is union (not a restriction of union) and derived type is not union
return ((Datatype_union)datatype).IsUnionBaseOf(this);
}
else if ((variety == XmlSchemaDatatypeVariety.Union || variety == XmlSchemaDatatypeVariety.List) && restriction == null) { //derived type is union (not a restriction)
return (datatype == anySimpleType.Datatype);
}
return false;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:24,代码来源:DataTypeImplementation.cs
示例19: SimpleTypeValidator
internal SimpleTypeValidator(XmlSchemaDatatypeVariety variety,
XmlSchemaSimpleType type,
FacetsChecker facetsChecker,
RestrictionFacets facets) {
this.restrictionFacets = facets;
this.facetsChecker = facetsChecker;
this.dataType = type.Datatype;
this.variety = variety;
}
开发者ID:pusp,项目名称:o2platform,代码行数:9,代码来源:SimpleTypeValidator.cs
注:本文中的XmlSchemaDatatype类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论