Beispiel #1
0
		// Return false if there is already the same key.
		public bool SetIdentityField (object identity, bool isXsiNil, XsdAnySimpleType type, int depth, IXmlLineInfo li)
		{
			FieldFoundDepth = depth;
			Identity = identity;
			IsXsiNil = isXsiNil;
			FieldFound |= isXsiNil;
			FieldType = type;
			Consuming = false;
			Consumed = true;
			if (li != null && li.HasLineInfo ()) {
				FieldHasLineInfo = true;
				FieldLineNumber = li.LineNumber;
				FieldLinePosition = li.LinePosition;
			}

			if (!(this.entry.OwnerSequence.SourceSchemaIdentity is XmlSchemaKeyref)) {
				for (int i = 0; i < entry.OwnerSequence.FinishedEntries.Count; i++) {
					XsdKeyEntry other = (XsdKeyEntry) entry.OwnerSequence.FinishedEntries [i];
					if (this.entry.CompareIdentity (other))
						return false;
				}
			}

			return true;
		}
Beispiel #2
0
        // Return false if there is already the same key.
        public bool SetIdentityField(object identity, bool isXsiNil, XsdAnySimpleType type, int depth, IXmlLineInfo li)
        {
            FieldFoundDepth = depth;
            Identity        = identity;
            IsXsiNil        = isXsiNil;
            FieldFound     |= isXsiNil;
            FieldType       = type;
            Consuming       = false;
            Consumed        = true;
            if (li != null && li.HasLineInfo())
            {
                FieldHasLineInfo  = true;
                FieldLineNumber   = li.LineNumber;
                FieldLinePosition = li.LinePosition;
            }

            if (!(this.entry.OwnerSequence.SourceSchemaIdentity is XmlSchemaKeyref))
            {
                for (int i = 0; i < entry.OwnerSequence.FinishedEntries.Count; i++)
                {
                    XsdKeyEntry other = (XsdKeyEntry)entry.OwnerSequence.FinishedEntries [i];
                    if (this.entry.CompareIdentity(other))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Beispiel #3
0
		static XsdAnySimpleType ()
		{
			instance = new XsdAnySimpleType ();
		}
Beispiel #4
0
		public static bool AreSchemaDatatypeEqual (XsdAnySimpleType st1, object v1,
			XsdAnySimpleType st2, object v2)
		{
			if (v1 == null || v2 == null)
				return false;

			if (st1 == null)
				st1 = XmlSchemaSimpleType.AnySimpleType;
			if (st2 == null)
				st2 = XmlSchemaSimpleType.AnySimpleType;

			Type t = st2.GetType ();
			if (st1 is XsdFloat) {
				return st2 is XsdFloat && Convert.ToSingle (v1) == Convert.ToSingle (v2);
			} else if (st1 is XsdDouble) {
				return st2 is XsdDouble && Convert.ToDouble (v1) == Convert.ToDouble (v2);
			} else if (st1 is XsdDecimal) {
				if (!(st2 is XsdDecimal) || Convert.ToDecimal (v1) != Convert.ToDecimal (v2))
					return false;
				if (st1 is XsdNonPositiveInteger)
					return st2 is XsdNonPositiveInteger || t == typeof (XsdDecimal) || t == typeof (XsdInteger);
				else if (st1 is XsdPositiveInteger)
					return st2 is XsdPositiveInteger || t == typeof (XsdDecimal) || 
						t == typeof (XsdInteger) || t == typeof (XsdNonNegativeInteger);
				else if (st1 is XsdUnsignedLong)
					return st2 is XsdUnsignedLong || t == typeof (XsdDecimal) || 
						t == typeof (XsdInteger) || t == typeof (XsdNonNegativeInteger);
				else if (st1 is XsdNonNegativeInteger)
					return st2 is XsdNonNegativeInteger || t == typeof (XsdDecimal) || t == typeof (XsdInteger);
				else if (st1 is XsdLong)
					return st2 is XsdLong || t == typeof (XsdDecimal) || t == typeof (XsdInteger);
				return true;
			}
			else if (!v1.Equals (v2))
				return false;
			if (st1 is XsdString) {
				if (!(st2 is XsdString))
					return false;
				if (st1 is XsdNMToken && (st2 is XsdLanguage || st2 is XsdName))
					return false;
				if (st2 is XsdNMToken && (st1 is XsdLanguage || st1 is XsdName))
					return false;
				if (st1 is XsdName && (st2 is XsdLanguage || st2 is XsdNMToken))
					return false;
				if (st2 is XsdName && (st1 is XsdLanguage || st1 is XsdNMToken))
					return false;
				if (st1 is XsdID && st2 is XsdIDRef)
					return false;
				if (st1 is XsdIDRef && st2 is XsdID)
					return false;
			}
			else if (st1 != st2)
				return false;
			return true;
		}
 static XsdAnySimpleType()
 {
     XsdAnySimpleType.instance = new XsdAnySimpleType();
 }