Наследование: XmlSchemaAnnotated
Пример #1
0
		//<selector 
		//  id = ID 
		//  xpath = a subset of XPath expression, see below 
		//  {any attributes with non-schema namespace . . .}>
		//  Content: (annotation?)
		//</selector>
		internal static XmlSchemaXPath Read(XmlSchemaReader reader, ValidationEventHandler h,string name)
		{
			XmlSchemaXPath path = new XmlSchemaXPath();
			reader.MoveToElement();

			if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != name)
			{
				error(h,"Should not happen :1: XmlSchemaComplexContentRestriction.Read, name="+reader.Name,null);
				reader.Skip();
				return null;
			}

			path.LineNumber = reader.LineNumber;
			path.LinePosition = reader.LinePosition;
			path.SourceUri = reader.BaseURI;

			XmlNamespaceManager currentMgr = XmlSchemaUtil.GetParserContext (reader.Reader).NamespaceManager;
			if (currentMgr != null) {
				path.nsmgr = new XmlNamespaceManager (reader.NameTable);
				IEnumerator e = currentMgr.GetEnumerator ();
				while (e.MoveNext ()) {
					string prefix = e.Current as string;
					switch (prefix) {
					case "xml":
					case "xmlns":
						continue;
					default:
						path.nsmgr.AddNamespace (prefix, currentMgr.LookupNamespace (prefix, false));
						break;
					}
				}
			}

			while(reader.MoveToNextAttribute())
			{
				if(reader.Name == "id")
				{
					path.Id = reader.Value;
				}
				else if(reader.Name == "xpath")
				{
					path.xpath = reader.Value;
				}
				else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
				{
					error(h,reader.Name + " is not a valid attribute for "+name,null);
				}
				else
				{
					XmlSchemaUtil.ReadUnhandledAttribute(reader,path);
				}
			}

			reader.MoveToElement();	
			if(reader.IsEmptyElement)
				return path;

			//  Content: (annotation?)
			int level = 1;
			while(reader.ReadNextElement())
			{
				if(reader.NodeType == XmlNodeType.EndElement)
				{
					if(reader.LocalName != name)
						error(h,"Should not happen :2: XmlSchemaXPath.Read, name="+reader.Name,null);
					break;
				}
				if(level <= 1 && reader.LocalName == "annotation")
				{
					level = 2;	//Only one annotation
					XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
					if(annotation != null)
						path.Annotation = annotation;
					continue;
				}
				reader.RaiseInvalidElementError();
			}
			return path;
		}
Пример #2
0
        /// <summary>
        /// Schemas the key. Not used currently
        /// </summary>
        /// <returns>key a </returns>
        public static XmlSchemaKey SchemaKey()
        {
            var elementKey = new XmlSchemaKey
                                 {
                                     Name = "AccountKey",
                                     Selector = new XmlSchemaXPath
                                                    {
                                                        XPath = "r:parts/r:part"
                                                    }
                                 };

            {
                var field = new XmlSchemaXPath
                                {
                                    XPath = "@number"
                                };

                elementKey.Fields.Add(field);
            }

            return elementKey;
        }
 internal override int Compile(ValidationEventHandler h, XmlSchema schema)
 {
     if (this.CompilationId == schema.CompilationId)
     {
         return(0);
     }
     if (this.Name == null)
     {
         base.error(h, "Required attribute name must be present");
     }
     else if (!XmlSchemaUtil.CheckNCName(this.name))
     {
         base.error(h, "attribute name must be NCName");
     }
     else
     {
         this.qName = new XmlQualifiedName(this.Name, base.AncestorSchema.TargetNamespace);
         if (schema.NamedIdentities.Contains(this.qName))
         {
             XmlSchemaIdentityConstraint xmlSchemaIdentityConstraint = schema.NamedIdentities[this.qName] as XmlSchemaIdentityConstraint;
             base.error(h, string.Format("There is already same named identity constraint in this namespace. Existing item is at {0}({1},{2})", xmlSchemaIdentityConstraint.SourceUri, xmlSchemaIdentityConstraint.LineNumber, xmlSchemaIdentityConstraint.LinePosition));
         }
         else
         {
             schema.NamedIdentities.Add(this.qName, this);
         }
     }
     if (this.Selector == null)
     {
         base.error(h, "selector must be present");
     }
     else
     {
         this.Selector.isSelector = true;
         this.errorCount         += this.Selector.Compile(h, schema);
         if (this.selector.errorCount == 0)
         {
             this.compiledSelector = new XsdIdentitySelector(this.Selector);
         }
     }
     if (this.errorCount > 0)
     {
         return(this.errorCount);
     }
     if (this.Fields.Count == 0)
     {
         base.error(h, "atleast one field value must be present");
     }
     else
     {
         for (int i = 0; i < this.Fields.Count; i++)
         {
             XmlSchemaXPath xmlSchemaXPath = this.Fields[i] as XmlSchemaXPath;
             if (xmlSchemaXPath != null)
             {
                 this.errorCount += xmlSchemaXPath.Compile(h, schema);
                 if (xmlSchemaXPath.errorCount == 0)
                 {
                     this.compiledSelector.AddField(new XsdIdentityField(xmlSchemaXPath, i));
                 }
             }
             else
             {
                 base.error(h, "Object of type " + this.Fields[i].GetType() + " is invalid in the Fields Collection");
             }
         }
     }
     XmlSchemaUtil.CompileID(base.Id, this, schema.IDCollection, h);
     this.CompilationId = schema.CompilationId;
     return(this.errorCount);
 }
 void Write49_XmlSchemaXPath(string name, string ns, XmlSchemaXPath o) {
     if ((object)o == null) return;
     WriteStartElement(name);
     WriteAttribute(@"id", @"", o.@Id);
     WriteAttribute(@"xpath", @"", o.@XPath);
     WriteAttributes((XmlAttribute[])o.@UnhandledAttributes, o);
     Write5_XmlSchemaAnnotation((XmlSchemaAnnotation)o.@Annotation);
     WriteEndElement();
 }
Пример #5
0
        //<selector
        //  id = ID
        //  xpath = a subset of XPath expression, see below
        //  {any attributes with non-schema namespace . . .}>
        //  Content: (annotation?)
        //</selector>
        internal static XmlSchemaXPath Read(XmlSchemaReader reader, ValidationEventHandler h, string name)
        {
            XmlSchemaXPath path = new XmlSchemaXPath();

            reader.MoveToElement();

            if (reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != name)
            {
                error(h, "Should not happen :1: XmlSchemaComplexContentRestriction.Read, name=" + reader.Name, null);
                reader.Skip();
                return(null);
            }

            path.LineNumber   = reader.LineNumber;
            path.LinePosition = reader.LinePosition;
            path.SourceUri    = reader.BaseURI;

            XmlNamespaceManager currentMgr = XmlSchemaUtil.GetParserContext(reader.Reader).NamespaceManager;

            if (currentMgr != null)
            {
                path.nsmgr = new XmlNamespaceManager(reader.NameTable);
                IEnumerator e = currentMgr.GetEnumerator();
                while (e.MoveNext())
                {
                    string prefix = e.Current as string;
                    switch (prefix)
                    {
                    case "xml":
                    case "xmlns":
                        continue;

                    default:
                        path.nsmgr.AddNamespace(prefix, currentMgr.LookupNamespace(prefix, false));
                        break;
                    }
                }
            }

            while (reader.MoveToNextAttribute())
            {
                if (reader.Name == "id")
                {
                    path.Id = reader.Value;
                }
                else if (reader.Name == "xpath")
                {
                    path.xpath = reader.Value;
                }
                else if ((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
                {
                    error(h, reader.Name + " is not a valid attribute for " + name, null);
                }
                else
                {
                    XmlSchemaUtil.ReadUnhandledAttribute(reader, path);
                }
            }

            reader.MoveToElement();
            if (reader.IsEmptyElement)
            {
                return(path);
            }

            //  Content: (annotation?)
            int level = 1;

            while (reader.ReadNextElement())
            {
                if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (reader.LocalName != name)
                    {
                        error(h, "Should not happen :2: XmlSchemaXPath.Read, name=" + reader.Name, null);
                    }
                    break;
                }
                if (level <= 1 && reader.LocalName == "annotation")
                {
                    level = 2;                          //Only one annotation
                    XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader, h);
                    if (annotation != null)
                    {
                        path.Annotation = annotation;
                    }
                    continue;
                }
                reader.RaiseInvalidElementError();
            }
            return(path);
        }
Пример #6
0
 private void SetContainer(State state, object container) {
     switch (state) {
         case State.Root:
             break;
         case State.Schema:
             break;
         case State.Annotation:
             this.annotation = (XmlSchemaAnnotation)container;
             break;
         case State.Include:
             this.include = (XmlSchemaInclude)container;
             break;
         case State.Import:
             this.import = (XmlSchemaImport)container;
             break;
         case State.Element:
             this.element = (XmlSchemaElement)container;
             break;
         case State.Attribute:
             this.attribute = (XmlSchemaAttribute)container;
             break;
         case State.AttributeGroup:
             this.attributeGroup = (XmlSchemaAttributeGroup)container;
             break;
         case State.AttributeGroupRef:
             this.attributeGroupRef = (XmlSchemaAttributeGroupRef)container;
             break;
         case State.AnyAttribute:
             this.anyAttribute = (XmlSchemaAnyAttribute)container;
             break;
         case State.Group:
             this.group = (XmlSchemaGroup)container;
             break;
         case State.GroupRef:
             this.groupRef = (XmlSchemaGroupRef)container;
             break;
         case State.All:
             this.all = (XmlSchemaAll)container;
             break;
         case State.Choice:
             this.choice = (XmlSchemaChoice)container;
             break;
         case State.Sequence:
             this.sequence = (XmlSchemaSequence)container;
             break;
         case State.Any:
             this.anyElement = (XmlSchemaAny)container;
             break;
         case State.Notation:
             this.notation = (XmlSchemaNotation)container;
             break;
         case State.SimpleType:
             this.simpleType = (XmlSchemaSimpleType)container;
             break;
         case State.ComplexType:
             this.complexType = (XmlSchemaComplexType)container;
             break;
         case State.ComplexContent:
             this.complexContent = (XmlSchemaComplexContent)container;
             break;
         case State.ComplexContentExtension:
             this.complexContentExtension = (XmlSchemaComplexContentExtension)container;
             break;
         case State.ComplexContentRestriction:
             this.complexContentRestriction = (XmlSchemaComplexContentRestriction)container;
             break;
         case State.SimpleContent:
             this.simpleContent = (XmlSchemaSimpleContent)container;
             break;
         case State.SimpleContentExtension:
             this.simpleContentExtension = (XmlSchemaSimpleContentExtension)container;
             break;
         case State.SimpleContentRestriction:
             this.simpleContentRestriction = (XmlSchemaSimpleContentRestriction)container;
             break;
         case State.SimpleTypeUnion:
             this.simpleTypeUnion = (XmlSchemaSimpleTypeUnion)container;
             break;
         case State.SimpleTypeList:
             this.simpleTypeList = (XmlSchemaSimpleTypeList)container;
             break;
         case State.SimpleTypeRestriction:
             this.simpleTypeRestriction = (XmlSchemaSimpleTypeRestriction)container;
             break;
         case State.Unique:
         case State.Key:
         case State.KeyRef:
             this.identityConstraint = (XmlSchemaIdentityConstraint)container;
             break;
         case State.Selector:
         case State.Field:
             this.xpath = (XmlSchemaXPath)container;
             break;
         case State.MinExclusive:
         case State.MinInclusive:
         case State.MaxExclusive:
         case State.MaxInclusive:
         case State.TotalDigits:
         case State.FractionDigits:
         case State.Length:
         case State.MinLength:
         case State.MaxLength:
         case State.Enumeration:
         case State.Pattern:
         case State.WhiteSpace:
             this.facet = (XmlSchemaFacet)container;
             break;
         case State.AppInfo:
             this.appInfo = (XmlSchemaAppInfo)container;
             break;
         case State.Documentation:
             this.documentation = (XmlSchemaDocumentation)container;
             break;
         case State.Redefine:
             this.redefine = (XmlSchemaRedefine)container;
             break;
         default:
             Debug.Assert(false, "State is " + state);
             break;
     }
 }
Пример #7
0
        /*
         * internal new void error(ValidationEventHandler handle, string message)
         * {
         *  errorCount++;
         *  ValidationHandler.RaiseValidationError(handle, this, message);
         * }
         */

        //<key
        //  id = ID
        //  name = NCName
        //  {any attributes with non-schema namespace . . .}>
        //  Content: (annotation?, (selector, field+))
        //</key>
        internal static XmlSchemaKey Read(XmlSchemaReader reader, ValidationEventHandler h)
        {
            XmlSchemaKey key = new XmlSchemaKey();

            reader.MoveToElement();

            if (reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
            {
                error(h, "Should not happen :1: XmlSchemaKey.Read, name=" + reader.Name, null);
                reader.Skip();
                return(null);
            }

            key.LineNumber   = reader.LineNumber;
            key.LinePosition = reader.LinePosition;
            key.SourceUri    = reader.BaseURI;

            while (reader.MoveToNextAttribute())
            {
                if (reader.Name == "id")
                {
                    key.Id = reader.Value;
                }
                else if (reader.Name == "name")
                {
                    key.Name = reader.Value;
                }
                else if ((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
                {
                    error(h, reader.Name + " is not a valid attribute for key", null);
                }
                else
                {
                    XmlSchemaUtil.ReadUnhandledAttribute(reader, key);
                }
            }

            reader.MoveToElement();
            if (reader.IsEmptyElement)
            {
                return(key);
            }

            //  Content: annotation?, selector, field+
            int level = 1;

            while (reader.ReadNextElement())
            {
                if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (reader.LocalName != xmlname)
                    {
                        error(h, "Should not happen :2: XmlSchemaKey.Read, name=" + reader.Name, null);
                    }
                    break;
                }
                if (level <= 1 && reader.LocalName == "annotation")
                {
                    level = 2; //Only one annotation
                    XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader, h);
                    if (annotation != null)
                    {
                        key.Annotation = annotation;
                    }
                    continue;
                }
                if (level <= 2 && reader.LocalName == "selector")
                {
                    level = 3;
                    XmlSchemaXPath selector = XmlSchemaXPath.Read(reader, h, "selector");
                    if (selector != null)
                    {
                        key.Selector = selector;
                    }
                    continue;
                }
                if (level <= 3 && reader.LocalName == "field")
                {
                    level = 3;
                    if (key.Selector == null)
                    {
                        error(h, "selector must be defined before field declarations", null);
                    }
                    XmlSchemaXPath field = XmlSchemaXPath.Read(reader, h, "field");
                    if (field != null)
                    {
                        key.Fields.Add(field);
                    }
                    continue;
                }
                reader.RaiseInvalidElementError();
            }
            return(key);
        }
        internal static XmlSchemaKeyref Read(XmlSchemaReader reader, ValidationEventHandler h)
        {
            XmlSchemaKeyref xmlSchemaKeyref = new XmlSchemaKeyref();

            reader.MoveToElement();
            if (reader.NamespaceURI != "http://www.w3.org/2001/XMLSchema" || reader.LocalName != "keyref")
            {
                XmlSchemaObject.error(h, "Should not happen :1: XmlSchemaKeyref.Read, name=" + reader.Name, null);
                reader.Skip();
                return(null);
            }
            xmlSchemaKeyref.LineNumber   = reader.LineNumber;
            xmlSchemaKeyref.LinePosition = reader.LinePosition;
            xmlSchemaKeyref.SourceUri    = reader.BaseURI;
            while (reader.MoveToNextAttribute())
            {
                if (reader.Name == "id")
                {
                    xmlSchemaKeyref.Id = reader.Value;
                }
                else if (reader.Name == "name")
                {
                    xmlSchemaKeyref.Name = reader.Value;
                }
                else if (reader.Name == "refer")
                {
                    Exception ex;
                    xmlSchemaKeyref.refer = XmlSchemaUtil.ReadQNameAttribute(reader, out ex);
                    if (ex != null)
                    {
                        XmlSchemaObject.error(h, reader.Value + " is not a valid value for refer attribute", ex);
                    }
                }
                else if ((reader.NamespaceURI == string.Empty && reader.Name != "xmlns") || reader.NamespaceURI == "http://www.w3.org/2001/XMLSchema")
                {
                    XmlSchemaObject.error(h, reader.Name + " is not a valid attribute for keyref", null);
                }
                else
                {
                    XmlSchemaUtil.ReadUnhandledAttribute(reader, xmlSchemaKeyref);
                }
            }
            reader.MoveToElement();
            if (reader.IsEmptyElement)
            {
                return(xmlSchemaKeyref);
            }
            int num = 1;

            while (reader.ReadNextElement())
            {
                if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (reader.LocalName != "keyref")
                    {
                        XmlSchemaObject.error(h, "Should not happen :2: XmlSchemaKeyref.Read, name=" + reader.Name, null);
                    }
                    break;
                }
                if (num <= 1 && reader.LocalName == "annotation")
                {
                    num = 2;
                    XmlSchemaAnnotation xmlSchemaAnnotation = XmlSchemaAnnotation.Read(reader, h);
                    if (xmlSchemaAnnotation != null)
                    {
                        xmlSchemaKeyref.Annotation = xmlSchemaAnnotation;
                    }
                }
                else if (num <= 2 && reader.LocalName == "selector")
                {
                    num = 3;
                    XmlSchemaXPath xmlSchemaXPath = XmlSchemaXPath.Read(reader, h, "selector");
                    if (xmlSchemaXPath != null)
                    {
                        xmlSchemaKeyref.Selector = xmlSchemaXPath;
                    }
                }
                else if (num <= 3 && reader.LocalName == "field")
                {
                    num = 3;
                    if (xmlSchemaKeyref.Selector == null)
                    {
                        XmlSchemaObject.error(h, "selector must be defined before field declarations", null);
                    }
                    XmlSchemaXPath xmlSchemaXPath2 = XmlSchemaXPath.Read(reader, h, "field");
                    if (xmlSchemaXPath2 != null)
                    {
                        xmlSchemaKeyref.Fields.Add(xmlSchemaXPath2);
                    }
                }
                else
                {
                    reader.RaiseInvalidElementError();
                }
            }
            return(xmlSchemaKeyref);
        }
Пример #9
0
 protected virtual void Visit(XmlSchemaXPath xPath)
 {
 }
 private void Write49_XmlSchemaXPath(string name, string ns, XmlSchemaXPath o)
 {
     if (o != null)
     {
         this.WriteStartElement(name);
         this.WriteAttribute("id", "", o.Id);
         this.WriteAttribute("xpath", "", o.XPath);
         this.WriteAttributes(o.UnhandledAttributes, o);
         this.Write5_XmlSchemaAnnotation(o.Annotation);
         this.WriteEndElement();
     }
 }
Пример #11
0
        /// <remarks>
        /// 1. name must be present
        /// 2. selector and field must be present
        /// </remarks>
        internal override int Compile(ValidationEventHandler h, XmlSchema schema)
        {
            // If this is already compiled this time, simply skip.
            if (CompilationId == schema.CompilationId)
            {
                return(0);
            }

            if (Name == null)
            {
                error(h, "Required attribute name must be present");
            }
            else if (!XmlSchemaUtil.CheckNCName(this.name))
            {
                error(h, "attribute name must be NCName");
            }
            else
            {
                this.qName = new XmlQualifiedName(Name, AncestorSchema.TargetNamespace);
                if (schema.NamedIdentities.Contains(qName))
                {
                    XmlSchemaIdentityConstraint existing =
                        schema.NamedIdentities [qName] as XmlSchemaIdentityConstraint;
                    error(h, String.Format("There is already same named identity constraint in this namespace. Existing item is at {0}({1},{2})", existing.SourceUri, existing.LineNumber, existing.LinePosition));
                }
                else
                {
                    schema.NamedIdentities.Add(qName, this);
                }
            }

            if (Selector == null)
            {
                error(h, "selector must be present");
            }
            else
            {
                Selector.isSelector = true;
                errorCount         += Selector.Compile(h, schema);
                if (selector.errorCount == 0)
                {
                    compiledSelector = new XsdIdentitySelector(Selector);
                }
            }
            if (errorCount > 0)
            {
                return(errorCount);                // fatal
            }
            if (Fields.Count == 0)
            {
                error(h, "atleast one field value must be present");
            }
            else
            {
                for (int i = 0; i < Fields.Count; i++)
                {
                    XmlSchemaXPath field = Fields [i] as XmlSchemaXPath;
                    if (field != null)
                    {
                        errorCount += field.Compile(h, schema);
                        if (field.errorCount == 0)
                        {
                            this.compiledSelector.AddField(new XsdIdentityField(field, i));
                        }
                    }
                    else
                    {
                        error(h, "Object of type " + Fields [i].GetType() + " is invalid in the Fields Collection");
                    }
                }
            }
            XmlSchemaUtil.CompileID(Id, this, schema.IDCollection, h);

            this.CompilationId = schema.CompilationId;
            return(errorCount);
        }
 private void Write47_XmlSchemaXPath(string n, string ns, XmlSchemaXPath o, bool isNullable, bool needType)
 {
     if (o == null)
     {
         if (isNullable)
         {
             base.WriteNullTagLiteral(n, ns);
         }
     }
     else
     {
         if (!needType && !(o.GetType() == typeof(XmlSchemaXPath)))
         {
             throw base.CreateUnknownTypeException(o);
         }
         base.EscapeName = false;
         base.WriteStartElement(n, ns, o, false, o.Namespaces);
         if (needType)
         {
             base.WriteXsiType("XmlSchemaXPath", "http://www.w3.org/2001/XMLSchema");
         }
         base.WriteAttribute("id", "", o.Id);
         XmlAttribute[] unhandledAttributes = o.UnhandledAttributes;
         if (unhandledAttributes != null)
         {
             for (int i = 0; i < unhandledAttributes.Length; i++)
             {
                 XmlAttribute node = unhandledAttributes[i];
                 base.WriteXmlAttribute(node, o);
             }
         }
         if ((o.XPath != null) && (o.XPath.Length != 0))
         {
             base.WriteAttribute("xpath", "", o.XPath);
         }
         this.Write11_XmlSchemaAnnotation("annotation", "http://www.w3.org/2001/XMLSchema", o.Annotation, false, false);
         base.WriteEndElement(o);
     }
 }
Пример #13
0
        internal static XmlSchemaXPath Read(XmlSchemaReader reader, ValidationEventHandler h, string name)
        {
            XmlSchemaXPath xmlSchemaXPath = new XmlSchemaXPath();

            reader.MoveToElement();
            if (reader.NamespaceURI != "http://www.w3.org/2001/XMLSchema" || reader.LocalName != name)
            {
                XmlSchemaObject.error(h, "Should not happen :1: XmlSchemaComplexContentRestriction.Read, name=" + reader.Name, null);
                reader.Skip();
                return(null);
            }
            xmlSchemaXPath.LineNumber   = reader.LineNumber;
            xmlSchemaXPath.LinePosition = reader.LinePosition;
            xmlSchemaXPath.SourceUri    = reader.BaseURI;
            XmlNamespaceManager namespaceManager = XmlSchemaUtil.GetParserContext(reader.Reader).NamespaceManager;

            if (namespaceManager != null)
            {
                xmlSchemaXPath.nsmgr = new XmlNamespaceManager(reader.NameTable);
                foreach (object obj in namespaceManager)
                {
                    string text  = obj as string;
                    string text2 = text;
                    if (text2 != null)
                    {
                        if (XmlSchemaXPath.< > f__switch$map3C == null)
                        {
                            XmlSchemaXPath.< > f__switch$map3C = new Dictionary <string, int>(2)
                            {
                                {
                                    "xml",
                                    0
                                },
                                {
                                    "xmlns",
                                    0
                                }
                            };
                        }
                        int num;
                        if (XmlSchemaXPath.< > f__switch$map3C.TryGetValue(text2, out num))
                        {
                            if (num == 0)
                            {
                                continue;
                            }
                        }
                    }
                    xmlSchemaXPath.nsmgr.AddNamespace(text, namespaceManager.LookupNamespace(text, false));
                }
            }
            while (reader.MoveToNextAttribute())
            {
                if (reader.Name == "id")
                {
                    xmlSchemaXPath.Id = reader.Value;
                }
                else if (reader.Name == "xpath")
                {
                    xmlSchemaXPath.xpath = reader.Value;
                }
                else if ((reader.NamespaceURI == string.Empty && reader.Name != "xmlns") || reader.NamespaceURI == "http://www.w3.org/2001/XMLSchema")
                {
                    XmlSchemaObject.error(h, reader.Name + " is not a valid attribute for " + name, null);
                }
                else
                {
                    XmlSchemaUtil.ReadUnhandledAttribute(reader, xmlSchemaXPath);
                }
            }
            reader.MoveToElement();
            if (reader.IsEmptyElement)
            {
                return(xmlSchemaXPath);
            }
            int num2 = 1;

            while (reader.ReadNextElement())
            {
                if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (reader.LocalName != name)
                    {
                        XmlSchemaObject.error(h, "Should not happen :2: XmlSchemaXPath.Read, name=" + reader.Name, null);
                    }
                    break;
                }
                if (num2 <= 1 && reader.LocalName == "annotation")
                {
                    num2 = 2;
                    XmlSchemaAnnotation xmlSchemaAnnotation = XmlSchemaAnnotation.Read(reader, h);
                    if (xmlSchemaAnnotation != null)
                    {
                        xmlSchemaXPath.Annotation = xmlSchemaAnnotation;
                    }
                }
                else
                {
                    reader.RaiseInvalidElementError();
                }
            }
            return(xmlSchemaXPath);
        }
Пример #14
0
		public XsdIdentityField (XmlSchemaXPath field, int index)
		{
			this.index = index;
			fieldPaths = field.CompiledExpression;
		}
Пример #15
0
		public XsdIdentitySelector (XmlSchemaXPath selector)
		{
			selectorPaths = selector.CompiledExpression;
		}