public class XmlSchemaMaxExclusiveFacet : XmlSchemaFacet
|
using System; using System.Xml; using System.Xml.Schema; class XMLSchemaExamples { public static void Main() { XmlSchema schema = new XmlSchema(); // <xs:simpleType name="WaitQueueLengthType"> XmlSchemaSimpleType WaitQueueLengthType = new XmlSchemaSimpleType(); WaitQueueLengthType.Name = "WaitQueueLengthType"; // <xs:restriction base="xs:int"> XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction(); restriction.BaseTypeName = new XmlQualifiedName("int", "http://www.w3.org/2001/XMLSchema"); // <xs:maxExclusive value="5"/> XmlSchemaMaxExclusiveFacet maxExclusive = new XmlSchemaMaxExclusiveFacet(); maxExclusive.Value = "5"; restriction.Facets.Add(maxExclusive); WaitQueueLengthType.Content = restriction; schema.Items.Add(WaitQueueLengthType); // <xs:element name="Lobby"> XmlSchemaElement element = new XmlSchemaElement(); element.Name = "Lobby"; // <xs:complexType> XmlSchemaComplexType complexType = new XmlSchemaComplexType(); // <xs:attribute name="WaitQueueLength" type="WaitQueueLengthType"/> XmlSchemaAttribute WaitQueueLengthAttribute = new XmlSchemaAttribute(); WaitQueueLengthAttribute.Name = "WaitQueueLength"; WaitQueueLengthAttribute.SchemaTypeName = new XmlQualifiedName("WaitQueueLengthType", ""); complexType.Attributes.Add(WaitQueueLengthAttribute); element.SchemaType = complexType; schema.Items.Add(element); schema.Compile(new ValidationEventHandler(ValidationCallbackOne)); XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable()); nsmgr.AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); schema.Write(Console.Out, nsmgr); } public static void ValidationCallbackOne(object sender, ValidationEventArgs args) { Console.WriteLine(args.Message); } }
The following XML file is generated for the preceding code example.
<?xml version="1.0" encoding="IBM437"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:simpleType name="WaitQueueLengthType"> <xs:restriction base="xs:int"> <xs:maxExclusive value="5"/> </xs:restriction> </xs:simpleType> <xs:element name="Lobby"> <xs:complexType> <xs:attribute name="WaitQueueLength" type="WaitQueueLengthType"/> </xs:complexType> </xs:element> </xs:schema>
ctor #1 | Default constructor. This constructor is called by derived class constructors to initialize state in this type. |
Annotation (inherited from System.Xml.Schema.XmlSchemaAnnotated) |
Read-write See base class member description: System.Xml.Schema.XmlSchemaAnnotated.Annotation Gets or sets the annotation property. |
Id (inherited from System.Xml.Schema.XmlSchemaAnnotated) |
Read-write See base class member description: System.Xml.Schema.XmlSchemaAnnotated.Id Gets or sets the string id. |
IsFixed (inherited from System.Xml.Schema.XmlSchemaFacet) |
Read-write See base class member description: System.Xml.Schema.XmlSchemaFacet.IsFixed Gets or sets information that indicates that this facet is fixed. This property is unused by XmlSchemaEnumerationFacet and XmlSchemaPatternFacet because these classes cannot be fixed. |
LineNumber (inherited from System.Xml.Schema.XmlSchemaObject) |
Read-write See base class member description: System.Xml.Schema.XmlSchemaObject.LineNumber Gets or sets the line number in the file to which the schema element refers. |
LinePosition (inherited from System.Xml.Schema.XmlSchemaObject) |
Read-write See base class member description: System.Xml.Schema.XmlSchemaObject.LinePosition Gets or sets the line position in the file to which the schema element refers. |
Namespaces (inherited from System.Xml.Schema.XmlSchemaObject) |
Read-write See base class member description: System.Xml.Schema.XmlSchemaObject.Namespaces |
SourceUri (inherited from System.Xml.Schema.XmlSchemaObject) |
Read-write See base class member description: System.Xml.Schema.XmlSchemaObject.SourceUri Gets or sets the source location for the file that loaded the schema. |
UnhandledAttributes (inherited from System.Xml.Schema.XmlSchemaAnnotated) |
Read-write See base class member description: System.Xml.Schema.XmlSchemaAnnotated.UnhandledAttributes Gets or sets the qualified attributes that do not belong to the schema target namespace. |
Value (inherited from System.Xml.Schema.XmlSchemaFacet) |
Read-write See base class member description: System.Xml.Schema.XmlSchemaFacet.Value Gets or sets the value attribute of the facet. |
Equals (inherited from System.Object) |
See base class member description: System.Object.Equals Derived from System.Object, the primary base class for all objects. |
GetHashCode (inherited from System.Object) |
See base class member description: System.Object.GetHashCode Derived from System.Object, the primary base class for all objects. |
GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
ToString (inherited from System.Object) |
See base class member description: System.Object.ToString Derived from System.Object, the primary base class for all objects. |
Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Hierarchy:
public XmlSchemaMaxExclusiveFacet(); |
public XmlSchemaAnnotation Annotation {get; set;}
|
public string Id {get; set;}
|
Optional.
This property is unused by XmlSchemaEnumerationFacet and XmlSchemaPatternFacet because these classes cannot be fixed.
public virtual bool IsFixed {get; set;}
|
public int LineNumber {get; set;}
|
public int LinePosition {get; set;}
|
public XmlSerializerNamespaces Namespaces {get; set;}
|
public string SourceUri {get; set;}
|
public XmlAttribute[] UnhandledAttributes {get; set;}
|
public string Value {get; set;}
|
~XmlSchemaMaxExclusiveFacet(); |
public virtual int GetHashCode(); |
public Type GetType(); |
protected object MemberwiseClone(); |
public virtual string ToString(); |