1 // Author: Dwivedi, Ajay kumar
\r
6 namespace System.Xml.Schema
\r
9 /// Summary description for XmlSchemaMaxInclusiveFacet.
\r
11 public class XmlSchemaMaxInclusiveFacet : XmlSchemaFacet
\r
13 private static string xmlname = "maxInclusive";
\r
15 public XmlSchemaMaxInclusiveFacet()
\r
20 // fixed = boolean : false
\r
22 // value = anySimpleType
\r
23 // {any attributes with non-schema namespace . . .}>
\r
24 // Content: (annotation?)
\r
26 internal static XmlSchemaMaxInclusiveFacet Read(XmlSchemaReader reader, ValidationEventHandler h)
\r
28 XmlSchemaMaxInclusiveFacet maxi = new XmlSchemaMaxInclusiveFacet();
\r
29 reader.MoveToElement();
\r
31 if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
\r
33 error(h,"Should not happen :1: XmlSchemaMaxInclusiveFacet.Read, name="+reader.Name,null);
\r
38 maxi.LineNumber = reader.LineNumber;
\r
39 maxi.LinePosition = reader.LinePosition;
\r
40 maxi.SourceUri = reader.BaseURI;
\r
42 while(reader.MoveToNextAttribute())
\r
44 if(reader.Name == "id")
\r
46 maxi.Id = reader.Value;
\r
48 else if(reader.Name == "fixed")
\r
51 maxi.IsFixed = XmlSchemaUtil.ReadBoolAttribute(reader,out innerex);
\r
53 error(h, reader.Value + " is not a valid value for fixed attribute",innerex);
\r
55 else if(reader.Name == "value")
\r
57 maxi.Value = reader.Value;
\r
59 else if(reader.NamespaceURI == "" || reader.NamespaceURI == XmlSchema.Namespace)
\r
61 error(h,reader.Name + " is not a valid attribute for "+xmlname,null);
\r
65 if(reader.Prefix == "xmlns")
\r
66 maxi.Namespaces.Add(reader.LocalName, reader.Value);
\r
67 else if(reader.Name == "xmlns")
\r
68 maxi.Namespaces.Add("",reader.Value);
\r
69 //TODO: Add to Unhandled attributes
\r
73 reader.MoveToElement();
\r
74 if(reader.IsEmptyElement)
\r
77 // Content: (annotation?)
\r
79 while(reader.ReadNextElement())
\r
81 if(reader.NodeType == XmlNodeType.EndElement)
\r
83 if(reader.LocalName != xmlname)
\r
84 error(h,"Should not happen :2: XmlSchemaMaxInclusiveFacet.Read, name="+reader.Name,null);
\r
87 if(level <= 1 && reader.LocalName == "annotation")
\r
89 level = 2; //Only one annotation
\r
90 XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
\r
91 if(annotation != null)
\r
92 maxi.Annotation = annotation;
\r
95 reader.RaiseInvalidElementError();
\r