次の方法で共有


XmlSchemaNotation クラス

クラスは、表記を表します。XML スキーマ定義言語 (XSD) 表記宣言は、XML 1.0 NOTATION 宣言を再構築したものです。表記の目的は、XML ドキュメント内の XML 以外のデータの書式を記述することです。W3C (World Wide Web Consortium) notation 要素を表します。

この型のすべてのメンバの一覧については、XmlSchemaNotation メンバ を参照してください。

System.Object
   System.Xml.Schema.XmlSchemaObject
      System.Xml.Schema.XmlSchemaAnnotated
         System.Xml.Schema.XmlSchemaNotation

Public Class XmlSchemaNotation
   Inherits XmlSchemaAnnotated
[C#]
public class XmlSchemaNotation : XmlSchemaAnnotated
[C++]
public __gc class XmlSchemaNotation : public XmlSchemaAnnotated
[JScript]
public class XmlSchemaNotation extends XmlSchemaAnnotated

スレッドセーフ

この型の public static (Visual Basicでは Shared) のすべてのメンバは、マルチスレッド操作で安全に使用できます。インスタンスのメンバの場合は、スレッドセーフであるとは限りません。

使用例

[Visual Basic, C#, C++] XmlSchemaNotation クラスを使用する例を次に示します。

 
Imports System
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)
        
    schema.Compile(AddressOf ValidationCallbackOne)
    Dim nsmgr As New XmlNamespaceManager(New NameTable())
    nsmgr.AddNamespace("xs", "http://www.w3.org/2001/XMLSchema")
    schema.Write(Console.Out, nsmgr)
     End Sub
        
    Public Shared Sub ValidationCallbackOne(sender As Object, args As ValidationEventArgs)
      Console.WriteLine(args.Message)
    End Sub 'ValidationCallbackOne
End Class 'XMLSchemaExamples

[C#] 
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);
        
        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);
    }
}

[C++] 
#using <mscorlib.dll>
#using <System.Xml.dll>
using namespace System;
using namespace System::Xml;  
using namespace System::Xml::Schema;

__gc class XMLSchemaExamples 
{
public:
   static void ValidationCallbackOne(Object* sender, ValidationEventArgs * args) 
   {
      Console::WriteLine(args -> Message);
   }
};

int main() 
{

   XmlSchema* schema = new XmlSchema();

   // <xs:notation name=S"jpeg" public=S"image/jpeg" system=S"viewer.exe" />
   XmlSchemaNotation* notation = new XmlSchemaNotation();
   notation -> Name = S"jpeg";
   notation -> Public = S"image/jpeg";
   notation -> System = S"viewer.exe";

   schema -> Items->Add(notation);

   schema -> Compile(new ValidationEventHandler(schema, XMLSchemaExamples::ValidationCallbackOne));
   XmlNamespaceManager* nsmgr = new XmlNamespaceManager(new NameTable());
   nsmgr -> AddNamespace(S"xs", S"http://www.w3.org/2001/XMLSchema");
   schema -> Write(Console::Out, nsmgr);
}

[Visual Basic, C#, C++] 前述のコード例に対して生成される XML ファイルを次に示します。

<?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>

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

名前空間: System.Xml.Schema

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

アセンブリ: System.Xml (System.Xml.dll 内)

参照

XmlSchemaNotation メンバ | System.Xml.Schema 名前空間