XmlSchemaResolver Class
Provides a class that can manage XML
schema data.
public class XmlSchemaResolver : IXmlSchemaResolver
- Inheritance:
- System.Object Object
- Implements:
- IXmlSchemaResolver
Remarks
Instances of this object can be registered with an ISyntaxLanguage using the RegisterService(Object, Object) method. Once an instance is registered with the language for the IXmlSchemaResolver interface type, its features can be used by the language.
Constructors
XmlSchemaResolver()
Initializes a new instance of the XmlSchemaResolver
class.
public XmlSchemaResolver()
Properties
DefaultNamespace
Gets or sets the default XML namespace to use.
public string DefaultNamespace { get; set; }
Property Value
- System.String:
The default XML namespace to use.
Remarks
The default namespace is used to mimic an xmlns
attribute setting on the root element, if no xmlns
attribute is present.
It sets an empty-string-keyed value into the DefaultNamespacePrefixMappings dictionary.
DefaultNamespacePrefixMappings
Gets the mapping dictionary of namespace prefix to namespaces that are declared by default without the need for xmlns
attributes in elements.
public IDictionary<string, string> DefaultNamespacePrefixMappings { get; }
Property Value
- System.Collections.Generic.IDictionary<System.String, System.String>:
The mapping dictionary of namespace prefix to namespaces that are declared by default without the need for
xmlns
attributes in elements.
Remarks
The dictionary keys are namespace prefixes and the values are namespaces.
The namespace declarations in this dictionary are used to mimic xmlns
attribute settings on the root element
when no xmlns
declaration attributes for the specified namespace prefix keys are present.
The DefaultNamespace property is simply a wrapper for setting an empty-string-keyed value in this dictionary.
SchemaSet
Gets or sets the System.Xml.Schema.XmlSchemaSet to use.
public XmlSchemaSet SchemaSet { get; set; }
Property Value
- System.Xml.Schema.XmlSchemaSet:
The System.Xml.Schema.XmlSchemaSet to use.
Remarks
This property can be set if you already have a XmlSchemaSet
loaded that should directly be used.
Methods
AddSchema(XmlSchema)
Adds another System.Xml.Schema.XmlSchema to the existing SchemaSet.
public void AddSchema(XmlSchema schema)
Parameter | Type | Description |
---|---|---|
schema | System.Xml.Schema.XmlSchema | The System.Xml.Schema.XmlSchema to load. |
AddSchemaFromFile(String)
Adds another System.Xml.Schema.XmlSchema from a file to the existing SchemaSet.
public void AddSchemaFromFile(string path)
Parameter | Type | Description |
---|---|---|
path | System.String | The path to the XSD schema file to load. |
AddSchemaFromStream(Stream)
Adds another System.Xml.Schema.XmlSchema from a System.IO.Stream to the existing SchemaSet.
public void AddSchemaFromStream(Stream stream)
Parameter | Type | Description |
---|---|---|
stream | System.IO.Stream | The System.IO.Stream from which to load. |
AddSchemaFromString(String)
Adds another System.Xml.Schema.XmlSchema from a string to the existing SchemaSet.
public void AddSchemaFromString(string schemaData)
Parameter | Type | Description |
---|---|---|
schemaData | System.String | The XSD schema data. |
GetChildSchemaElement(XmlSchemaElement, XmlQualifiedName)
Returns the child System.Xml.Schema.XmlSchemaElement that has the specified qualified name.
public XmlSchemaElement GetChildSchemaElement(XmlSchemaElement parentElement, XmlQualifiedName name)
Parameter | Type | Description |
---|---|---|
parentElement | System.Xml.Schema.XmlSchemaElement | The parent System.Xml.Schema.XmlSchemaElement. |
name | System.Xml.XmlQualifiedName | The System.Xml.XmlQualifiedName for which to search. |
Returns
- System.Xml.Schema.XmlSchemaElement:
The child System.Xml.Schema.XmlSchemaElement that has the specified qualified name.
GetChildSchemaElements(XmlSchemaElement)
Returns the child System.Xml.Schema.XmlSchemaElement objects.
public IEnumerable<XmlSchemaElement> GetChildSchemaElements(XmlSchemaElement parentElement)
Parameter | Type | Description |
---|---|---|
parentElement | System.Xml.Schema.XmlSchemaElement | The parent System.Xml.Schema.XmlSchemaElement. |
Returns
- System.Collections.Generic.IEnumerable<System.Xml.Schema.XmlSchemaElement>:
The child System.Xml.Schema.XmlSchemaElement objects.
GetDocumentation(XmlSchemaAnnotated)
Returns the XSD documentation for the specified source object.
public virtual string GetDocumentation(XmlSchemaAnnotated source)
Parameter | Type | Description |
---|---|---|
source | System.Xml.Schema.XmlSchemaAnnotated | The source System.Xml.Schema.XmlSchemaAnnotated for which the documentation is being retrieved. |
Returns
- System.String:
The documentation that was retrieved.
Remarks
The default implementation of this method appends the inner text of all the XmlSchemaDocumentation child nodes together, with whitespace in between.
GetGlobalSchemaElement(XmlQualifiedName)
Returns the global System.Xml.Schema.XmlSchemaElement that has the specified qualified name.
public XmlSchemaElement GetGlobalSchemaElement(XmlQualifiedName name)
Parameter | Type | Description |
---|---|---|
name | System.Xml.XmlQualifiedName | The System.Xml.XmlQualifiedName for which to search. |
Returns
- System.Xml.Schema.XmlSchemaElement:
The global System.Xml.Schema.XmlSchemaElement that has the specified qualified name.
GetGlobalSchemaElements()
Returns the collection of global System.Xml.Schema.XmlSchemaElement objects.
public IEnumerable<XmlSchemaElement> GetGlobalSchemaElements()
Returns
- System.Collections.Generic.IEnumerable<System.Xml.Schema.XmlSchemaElement>:
The collection of global System.Xml.Schema.XmlSchemaElement objects.
GetSchemaAttributes(XmlSchemaElement)
Returns the child System.Xml.Schema.XmlSchemaAttribute objects.
public IEnumerable<XmlSchemaAttribute> GetSchemaAttributes(XmlSchemaElement parentElement)
Parameter | Type | Description |
---|---|---|
parentElement | System.Xml.Schema.XmlSchemaElement | The parent System.Xml.Schema.XmlSchemaElement. |
Returns
- System.Collections.Generic.IEnumerable<System.Xml.Schema.XmlSchemaAttribute>:
The child System.Xml.Schema.XmlSchemaAttribute objects.
GetSchemaElementContentFacets(XmlSchemaElement)
Returns the XmlSchemaFacet objects that are allowed as content of the specified System.Xml.Schema.XmlSchemaElement.
public static IEnumerable<XmlSchemaFacet> GetSchemaElementContentFacets(XmlSchemaElement element)
Parameter | Type | Description |
---|---|---|
element | System.Xml.Schema.XmlSchemaElement | The System.Xml.Schema.XmlSchemaElement to examine. |
Returns
- System.Collections.Generic.IEnumerable<XmlSchemaFacet>:
The XmlSchemaFacet objects that are allowed as content.
GetSchemaElementContentType(XmlSchemaElement)
Returns the System.Xml.Schema.XmlSchemaContentType for the specified System.Xml.Schema.XmlSchemaElement.
public static XmlSchemaContentType GetSchemaElementContentType(XmlSchemaElement element)
Parameter | Type | Description |
---|---|---|
element | System.Xml.Schema.XmlSchemaElement | The System.Xml.Schema.XmlSchemaElement to examine. |
Returns
- System.Xml.Schema.XmlSchemaContentType:
The System.Xml.Schema.XmlSchemaContentType for the specified System.Xml.Schema.XmlSchemaElement.
LoadSchema(XmlSchema)
Clears any existing SchemaSet and loads a new single System.Xml.Schema.XmlSchema.
public void LoadSchema(XmlSchema schema)
Parameter | Type | Description |
---|---|---|
schema | System.Xml.Schema.XmlSchema | The System.Xml.Schema.XmlSchema to load. |
Remarks
This method first clears any schemas currently in use and then loads a single specified schema.
LoadSchemaFromFile(String)
Clears any existing SchemaSet and loads a new single System.Xml.Schema.XmlSchema from a file.
public void LoadSchemaFromFile(string path)
Parameter | Type | Description |
---|---|---|
path | System.String | The path to the XSD schema file to load. |
Remarks
This method first clears any schemas currently in use and then loads a single specified schema.
LoadSchemaFromStream(Stream)
Clears any existing SchemaSet and loads a new single System.Xml.Schema.XmlSchema from a System.IO.Stream.
public void LoadSchemaFromStream(Stream stream)
Parameter | Type | Description |
---|---|---|
stream | System.IO.Stream | The System.IO.Stream from which to load. |
Remarks
This method first clears any schemas currently in use and then loads a single specified schema.
LoadSchemaFromString(String)
Clears any existing SchemaSet and loads a new single System.Xml.Schema.XmlSchema from a string.
public void LoadSchemaFromString(string schemaData)
Parameter | Type | Description |
---|---|---|
schemaData | System.String | The XSD schema data. |
ResolveSchemaAttribute(XmlSchemaAttribute)
Resolves the specified System.Xml.Schema.XmlSchemaAttribute in the event it is a reference to another System.Xml.Schema.XmlSchemaAttribute.
public XmlSchemaAttribute ResolveSchemaAttribute(XmlSchemaAttribute attribute)
Parameter | Type | Description |
---|---|---|
attribute | System.Xml.Schema.XmlSchemaAttribute | The System.Xml.Schema.XmlSchemaAttribute to examine. |
Returns
- System.Xml.Schema.XmlSchemaAttribute:
The resolved System.Xml.Schema.XmlSchemaAttribute.
Inherited Members
- System.Object.ToString()
- System.Object.Equals(System.Object)
- System.Object.Equals(System.Object, System.Object)
- System.Object.ReferenceEquals(System.Object, System.Object)
- System.Object.GetHashCode()
- System.Object.GetType()
- System.Object.MemberwiseClone()