示例#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);
        }
示例#2
0
 public bool CompareIdentity(XsdKeyEntry other)
 {
     for (int i = 0; i < this.KeyFields.Count; i++)
     {
         XsdKeyEntryField xsdKeyEntryField  = this.KeyFields[i];
         XsdKeyEntryField xsdKeyEntryField2 = other.KeyFields[i];
         if ((xsdKeyEntryField.IsXsiNil && !xsdKeyEntryField2.IsXsiNil) || (!xsdKeyEntryField.IsXsiNil && xsdKeyEntryField2.IsXsiNil))
         {
             return(false);
         }
         if (!XmlSchemaUtil.AreSchemaDatatypeEqual(xsdKeyEntryField2.FieldType, xsdKeyEntryField2.Identity, xsdKeyEntryField.FieldType, xsdKeyEntryField.Identity))
         {
             return(false);
         }
     }
     return(true);
 }
示例#3
0
 public bool CompareIdentity(XsdKeyEntry other)
 {
     for (int i = 0; i < KeyFields.Count; i++)
     {
         XsdKeyEntryField f  = this.KeyFields [i];
         XsdKeyEntryField of = other.KeyFields [i];
         if (f.IsXsiNil && !of.IsXsiNil || !f.IsXsiNil && of.IsXsiNil)
         {
             return(false);
         }
         if (!XmlSchemaUtil.AreSchemaDatatypeEqual(
                 of.FieldType, of.Identity, f.FieldType, f.Identity))
         {
             return(false);                      // does not match
         }
     }
     return(true);               // matches
 }
示例#4
0
		public XsdKeyEntryField (XsdKeyEntry entry, XsdIdentityField field)
		{
			this.entry = entry;
			this.field = field;
		}
示例#5
0
		public bool CompareIdentity (XsdKeyEntry other)
		{
			for (int i = 0; i < KeyFields.Count; i++) {
				XsdKeyEntryField f = this.KeyFields [i];
				XsdKeyEntryField of = other.KeyFields [i];
				if (f.IsXsiNil && !of.IsXsiNil || !f.IsXsiNil && of.IsXsiNil)
					return false;
				if (!XmlSchemaUtil.AreSchemaDatatypeEqual (
					of.FieldType, of.Identity, f.FieldType, f.Identity))
					return false;	// does not match
			}
			return true;	// matches
		}
示例#6
0
		public void Add (XsdKeyEntry entry)
		{
			List.Add (entry);
		}
示例#7
0
		private void ProcessKeyEntry (XsdKeyEntry entry)
		{
			bool isNil = XsiNilDepth == Depth;
			entry.ProcessMatch (false, elementQNameStack, this, NameTable, BaseURI, SchemaType, NamespaceManager, readerLineInfo, Depth, null, null, null, isNil, CurrentKeyFieldConsumers);
			if (MoveToFirstAttribute ()) {
				try {
					do {
						switch (NamespaceURI) {
						case XmlNamespaceManager.XmlnsXmlns:
						case XmlSchema.InstanceNamespace:
							continue;
						}
						XmlSchemaDatatype dt = SchemaType as XmlSchemaDatatype;
						XmlSchemaSimpleType st = SchemaType as XmlSchemaSimpleType;
						if (dt == null && st != null)
							dt = st.Datatype;
						object identity = null;
						if (dt != null)
							identity = dt.ParseValue (Value, NameTable, NamespaceManager);
						if (identity == null)
							identity = Value;
						entry.ProcessMatch (true, elementQNameStack, this, NameTable, BaseURI, SchemaType, NamespaceManager, readerLineInfo, Depth, LocalName, NamespaceURI, identity, false, CurrentKeyFieldConsumers);
					} while (MoveToNextAttribute ());
				} finally {
					MoveToElement ();
				}
			}
		}
示例#8
0
		// 3.11.4 Identity Constraint Satisfied
		private void ValidateKeySelectors ()
		{
			if (tmpKeyrefPool != null)
				tmpKeyrefPool.Clear ();
			if (Context.Element != null && Context.Element.Constraints.Count > 0) {
				// (a) Create new key sequences, if required.
				for (int i = 0; i < Context.Element.Constraints.Count; i++) {
					XmlSchemaIdentityConstraint ident = (XmlSchemaIdentityConstraint) Context.Element.Constraints [i];
					XsdKeyTable seq = CreateNewKeyTable (ident);
					if (ident is XmlSchemaKeyref) {
						if (tmpKeyrefPool == null)
							tmpKeyrefPool = new ArrayList ();
						tmpKeyrefPool.Add (seq);
					}
				}
			}

			// (b) Evaluate current key sequences.
			for (int i = 0; i < keyTables.Count; i++) {
				XsdKeyTable seq  = (XsdKeyTable) keyTables [i];
				if (seq.SelectorMatches (this.elementQNameStack, reader.Depth) != null) {
					// creates and registers new entry.
					XsdKeyEntry entry = new XsdKeyEntry (seq, reader.Depth, readerLineInfo);
					seq.Entries.Add (entry);
				}
			}
		}
 public void Add(XsdKeyEntry entry)
 {
     base.List.Add(entry);
 }
示例#10
0
 public XsdKeyEntryField(XsdKeyEntry entry, XsdIdentityField field)
 {
     this.entry = entry;
     this.field = field;
 }