XmlSchemaComplexType クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
World Wide Web Consortium (W3C) で指定された XML スキーマの complexType 要素を表します。 このクラスは、要素の属性とコンテンツのセットを決定する複合型を定義します。
public ref class XmlSchemaComplexType : System::Xml::Schema::XmlSchemaType
public class XmlSchemaComplexType : System.Xml.Schema.XmlSchemaType
type XmlSchemaComplexType = class
inherit XmlSchemaType
Public Class XmlSchemaComplexType
Inherits XmlSchemaType
- 継承
例
次の例では、 complexType 要素を作成します。
using System;
using System.Xml;
using System.Xml.Schema;
class XMLSchemaExamples
{
public static void Main()
{
XmlSchema schema = new XmlSchema();
// <xs:element name="stringElementWithAnyAttribute">
XmlSchemaElement element = new XmlSchemaElement();
schema.Items.Add(element);
element.Name = "stringElementWithAnyAttribute";
// <xs:complexType>
XmlSchemaComplexType complexType = new XmlSchemaComplexType();
element.SchemaType = complexType;
// <xs:simpleContent>
XmlSchemaSimpleContent simpleContent = new XmlSchemaSimpleContent();
complexType.ContentModel = simpleContent;
// <extension base= "xs:string">
XmlSchemaSimpleContentExtension extension = new XmlSchemaSimpleContentExtension();
simpleContent.Content = extension;
extension.BaseTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
// <xs:anyAttribute namespace="##targetNamespace"/>
XmlSchemaAnyAttribute anyAttribute = new XmlSchemaAnyAttribute();
extension.AnyAttribute = anyAttribute;
anyAttribute.Namespace = "##targetNamespace";
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 New XmlSchema()
' <xs:element name="stringElementWithAnyAttribute">
Dim element As New XmlSchemaElement()
schema.Items.Add(element)
element.Name = "stringElementWithAnyAttribute"
' <xs:complexType>
Dim complexType As New XmlSchemaComplexType()
element.SchemaType = complexType
' <xs:simpleContent>
Dim simpleContent As New XmlSchemaSimpleContent()
complexType.ContentModel = simpleContent
' <extension base="xs:string">
Dim extension As New XmlSchemaSimpleContentExtension()
simpleContent.Content = extension
extension.BaseTypeName = New XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema")
' <xs:anyAttribute namespace="##targetNamespace"/>
Dim anyAttribute As New XmlSchemaAnyAttribute()
extension.AnyAttribute = anyAttribute
anyAttribute.Namespace = "##targetNamespace"
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
前のコード例では、次の XML ファイルを使用します。
<?xml version="1.0" encoding="IBM437"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="stringElementWithAnyAttribute">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:anyAttribute namespace="##targetNamespace"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:schema>
注釈
要素は、その要素の構造、コンテンツ、および属性を定義する complexType 要素を参照する型属性を使用して宣言できます。
コンストラクター
| 名前 | 説明 |
|---|---|
| XmlSchemaComplexType() |
XmlSchemaComplexType クラスの新しいインスタンスを初期化します。 |
プロパティ
| 名前 | 説明 |
|---|---|
| Annotation |
|
| AnyAttribute |
複合型の XmlSchemaAnyAttribute コンポーネントの値を取得または設定します。 |
| Attributes |
複合型の属性のコレクションを取得します。 |
| AttributeUses |
この複合型とその基本型に準拠しているすべての属性のコレクションを取得します。 |
| AttributeWildcard |
この複合型とその基本型の |
| BaseSchemaType |
古い.
古い.
コンパイル後のオブジェクト型、または組み込みの XML スキーマ定義言語 (XSD) データ型、simpleType 要素、または complexType 要素を取得します。 これは、スキーマ コンパイル後の infoset プロパティです。 (継承元 XmlSchemaType) |
| BaseXmlSchemaType |
このスキーマ型の基本型のコンパイル後の値を取得します。 (継承元 XmlSchemaType) |
| Block |
|
| BlockResolved |
型がスキーマ検証後の情報セット (infoset) にコンパイルされた後の値を取得します。 この値は、インスタンス ドキュメントで |
| ContentModel |
この複合型のコンパイル後の XmlSchemaContentModel を取得または設定します。 |
| ContentType |
コンパイル後の値を保持する複合型のコンテンツ モデルを取得します。 |
| ContentTypeParticle |
ContentType パーティクルのコンパイル後の値を保持するパーティクルを取得します。 |
| Datatype |
複合型のデータ型のコンパイル後の値を取得します。 (継承元 XmlSchemaType) |
| DerivedBy |
この要素が基本型から派生した方法に関するコンパイル後の情報を取得します。 (継承元 XmlSchemaType) |
| Final |
追加の派生が許可されるかどうかを示す型派生の最終的な属性を取得または設定します。 (継承元 XmlSchemaType) |
| FinalResolved |
Final プロパティのコンパイル後の値を取得します。 (継承元 XmlSchemaType) |
| Id |
文字列 ID を取得または設定します。 (継承元 XmlSchemaAnnotated) |
| IsAbstract |
インスタンス ドキュメントで |
| IsMixed |
複合型に混合コンテンツ モデル (コンテンツ内のマークアップ) があるかどうかを決定する情報を取得または設定します。 |
| LineNumber |
|
| LinePosition |
|
| Name |
型の名前を取得または設定します。 (継承元 XmlSchemaType) |
| Namespaces |
このスキーマ オブジェクトで使用する XmlSerializerNamespaces を取得または設定します。 (継承元 XmlSchemaObject) |
| Parent |
この XmlSchemaObjectの親を取得または設定します。 (継承元 XmlSchemaObject) |
| Particle |
コンポジター型を、 XmlSchemaGroupRef、 XmlSchemaChoice、 XmlSchemaAll、または XmlSchemaSequence クラスの 1 つとして取得または設定します。 |
| QualifiedName |
この型の |
| SourceUri |
スキーマを読み込んだファイルのソースの場所を取得または設定します。 (継承元 XmlSchemaObject) |
| TypeCode |
型の XmlTypeCode を取得します。 (継承元 XmlSchemaType) |
| UnhandledAttributes |
現在のスキーマのターゲット名前空間に属していない修飾属性を取得または設定します。 (継承元 XmlSchemaAnnotated) |
メソッド
| 名前 | 説明 |
|---|---|
| Equals(Object) |
指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。 (継承元 Object) |
| GetHashCode() |
既定のハッシュ関数として機能します。 (継承元 Object) |
| GetType() |
現在のインスタンスの Type を取得します。 (継承元 Object) |
| MemberwiseClone() |
現在の Objectの簡易コピーを作成します。 (継承元 Object) |
| ToString() |
現在のオブジェクトを表す文字列を返します。 (継承元 Object) |