1 // Author: Dwivedi, Ajay kumar
\r
6 namespace System.Xml.Schema
\r
9 /// Summary description for XmlSchemaMinLengthFacet.
\r
11 public class XmlSchemaMinLengthFacet : XmlSchemaNumericFacet
\r
13 private static string xmlname = "minLength";
\r
15 public XmlSchemaMinLengthFacet()
\r
20 // fixed = boolean : false
\r
22 // value = nonNegativeInteger
\r
23 // {any attributes with non-schema namespace . . .}>
\r
24 // Content: (annotation?)
\r
26 internal static XmlSchemaMinLengthFacet Read(XmlSchemaReader reader, ValidationEventHandler h)
\r
28 XmlSchemaMinLengthFacet length = new XmlSchemaMinLengthFacet();
\r
29 reader.MoveToElement();
\r
31 if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
\r
33 error(h,"Should not happen :1: XmlSchemaMinLengthFacet.Read, name="+reader.Name,null);
\r
38 length.LineNumber = reader.LineNumber;
\r
39 length.LinePosition = reader.LinePosition;
\r
40 length.SourceUri = reader.BaseURI;
\r
42 while(reader.MoveToNextAttribute())
\r
44 if(reader.Name == "id")
\r
46 length.Id = reader.Value;
\r
48 else if(reader.Name == "fixed")
\r
51 length.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 length.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 //TODO: Add to Unhandled attributes
\r
69 reader.MoveToElement();
\r
70 if(reader.IsEmptyElement)
\r
73 // Content: (annotation?)
\r
75 while(reader.ReadNextElement())
\r
77 if(reader.NodeType == XmlNodeType.EndElement)
\r
79 if(reader.LocalName != xmlname)
\r
80 error(h,"Should not happen :2: XmlSchemaMinLengthFacet.Read, name="+reader.Name,null);
\r
83 if(level <= 1 && reader.LocalName == "annotation")
\r
85 level = 2; //Only one annotation
\r
86 XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
\r
87 if(annotation != null)
\r
88 length.Annotation = annotation;
\r
91 reader.RaiseInvalidElementError();
\r