public class XmlSchemaAppInfo : XmlSchemaObject
|
using System; using System.Xml; using System.Xml.Schema; class XMLSchemaExamples { public static void Main() { XmlSchema schema = new XmlSchema(); // <xs:element name="State"> XmlSchemaElement element = new XmlSchemaElement(); schema.Items.Add(element); element.Name = "State"; // <xs:annotation> XmlSchemaAnnotation annNorthwestStates = new XmlSchemaAnnotation(); element.Annotation = annNorthwestStates; // <xs:documentation>State Name</xs:documentation> XmlSchemaDocumentation docNorthwestStates = new XmlSchemaDocumentation(); annNorthwestStates.Items.Add(docNorthwestStates); docNorthwestStates.Markup = TextToNodeArray("State Name"); // <xs:appInfo>Application Information</xs:appInfo> XmlSchemaAppInfo appInfo = new XmlSchemaAppInfo(); annNorthwestStates.Items.Add(appInfo); appInfo.Markup = TextToNodeArray("Application Information"); 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); } public static XmlNode[] TextToNodeArray(string text) { XmlDocument doc = new XmlDocument(); return new XmlNode[1] {doc.CreateTextNode(text)}; } }
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:element name="State"> <xs:annotation> <xs:documentation>State Name</xs:documentation> <xs:appinfo>Application Information</xs:appinfo> </xs:annotation> </xs:element> </xs:schema>
ctor #1 | Default constructor. This constructor is called by derived class constructors to initialize state in this type. |
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. |
Markup | Read-write Gets or sets an array of XmlNode that represents the AppInfo child nodes. |
Namespaces (inherited from System.Xml.Schema.XmlSchemaObject) |
Read-write See base class member description: System.Xml.Schema.XmlSchemaObject.Namespaces |
Source | Read-write Gets or sets the source of the application information. |
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. |
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 XmlSchemaAppInfo(); |
public int LineNumber {get; set;}
|
public int LinePosition {get; set;}
|
public XmlNode[] Markup {get; set;}
|
public XmlSerializerNamespaces Namespaces {get; set;}
|
public string Source {get; set;}
|
public string SourceUri {get; set;}
|
~XmlSchemaAppInfo(); |
public virtual int GetHashCode(); |
public Type GetType(); |
protected object MemberwiseClone(); |
public virtual string ToString(); |