XmlSchemaNotation Classe
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Représente l’élément notation du schéma XML tel que spécifié par le World Wide Web Consortium (W3C). Une déclaration de schéma notation XML est une reconstruction des XML 1.0 NOTATION déclarations. L’objectif des notations est de décrire le format des données non XML dans un document XML.
public ref class XmlSchemaNotation : System::Xml::Schema::XmlSchemaAnnotated
public class XmlSchemaNotation : System.Xml.Schema.XmlSchemaAnnotated
type XmlSchemaNotation = class
inherit XmlSchemaAnnotated
Public Class XmlSchemaNotation
Inherits XmlSchemaAnnotated
- Héritage
Exemples
L’exemple suivant montre l’utilisation de la XmlSchemaNotation classe.
using System;
using System.Xml;
using System.Xml.Schema;
class XMLSchemaExamples
{
public static void Main()
{
XmlSchema schema = new XmlSchema();
// <xs:notation name="jpeg" public="image/jpeg" system="viewer.exe" />
XmlSchemaNotation notation = new XmlSchemaNotation();
notation.Name = "jpeg";
notation.Public = "image/jpeg";
notation.System = "viewer.exe";
schema.Items.Add(notation);
XmlSchemaSet schemaSet = new XmlSchemaSet();
schemaSet.ValidationEventHandler += new ValidationEventHandler(ValidationCallbackOne);
schemaSet.Add(schema);
schemaSet.Compile();
XmlSchema compiledSchema = null;
foreach (XmlSchema schema1 in schemaSet.Schemas())
{
compiledSchema = schema1;
}
XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable());
nsmgr.AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
compiledSchema.Write(Console.Out, nsmgr);
}
public static void ValidationCallbackOne(object sender, ValidationEventArgs args)
{
Console.WriteLine(args.Message);
}
}
Imports System.Xml
Imports System.Xml.Schema
Class XMLSchemaExamples
Public Shared Sub Main()
Dim schema As XmlSchema = New XmlSchema()
' <xs:notation name="jpeg" public="image/jpeg" system="viewer.exe" />
Dim notation As XmlSchemaNotation = New XmlSchemaNotation()
notation.Name = "jpeg"
notation.Public = "image/jpeg"
notation.System = "viewer.exe"
schema.Items.Add(notation)
Dim schemaSet As New XmlSchemaSet()
AddHandler schemaSet.ValidationEventHandler, AddressOf ValidationCallbackOne
schemaSet.Add(schema)
schemaSet.Compile()
Dim compiledSchema As XmlSchema = Nothing
For Each schema1 As XmlSchema In schemaSet.Schemas()
compiledSchema = schema1
Next
Dim nsmgr As New XmlNamespaceManager(New NameTable())
nsmgr.AddNamespace("xs", "http://www.w3.org/2001/XMLSchema")
compiledSchema.Write(Console.Out, nsmgr)
End Sub
Public Shared Sub ValidationCallbackOne(ByVal sender As Object, ByVal args As ValidationEventArgs)
Console.WriteLine(args.Message)
End Sub
End Class
Le fichier XML suivant est généré pour l’exemple de code précédent.
<?xml version="1.0" encoding="IBM437"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:notation name="jpeg" public="image/jpeg" system="viewer.exe" />
</xs:schema>
Constructeurs
| Nom | Description |
|---|---|
| XmlSchemaNotation() |
Initialise une nouvelle instance de la classe XmlSchemaNotation. |
Propriétés
| Nom | Description |
|---|---|
| Annotation |
Obtient ou définit la |
| Id |
Obtient ou définit l’ID de chaîne. (Hérité de XmlSchemaAnnotated) |
| LineNumber |
Obtient ou définit le numéro de ligne dans le fichier auquel l’élément |
| LinePosition |
Obtient ou définit la position de ligne dans le fichier auquel l’élément |
| Name |
Obtient ou définit le nom de la notation. |
| Namespaces |
Obtient ou définit l’utilisation XmlSerializerNamespaces avec cet objet de schéma. (Hérité de XmlSchemaObject) |
| Parent |
Obtient ou définit le parent de ce XmlSchemaObject. (Hérité de XmlSchemaObject) |
| Public |
Obtient ou définit l’identificateur |
| SourceUri |
Obtient ou définit l’emplacement source du fichier qui a chargé le schéma. (Hérité de XmlSchemaObject) |
| System |
Obtient ou définit l’identificateur |
| UnhandledAttributes |
Obtient ou définit les attributs qualifiés qui n’appartiennent pas à l’espace de noms cible du schéma actuel. (Hérité de XmlSchemaAnnotated) |
Méthodes
| Nom | Description |
|---|---|
| Equals(Object) |
Détermine si l’objet spécifié est égal à l’objet actuel. (Hérité de Object) |
| GetHashCode() |
Sert de fonction de hachage par défaut. (Hérité de Object) |
| GetType() |
Obtient la Type de l’instance actuelle. (Hérité de Object) |
| MemberwiseClone() |
Crée une copie superficielle du Objectactuel. (Hérité de Object) |
| ToString() |
Retourne une chaîne qui représente l’objet actuel. (Hérité de Object) |