Xml イベント
パブリック イベント
名前 | 説明 | |
---|---|---|
DataBinding | サーバー コントロールがデータ ソースに連結すると発生します。 ( Control から継承されます。) | |
Disposed | サーバー コントロールがメモリから解放されると発生します。これは、ASP.NET ページが要求されている場合のサーバー コントロールの有効期間における最終段階です。 ( Control から継承されます。) | |
Init | サーバー コントロールが初期化されると発生します。これは、サーバー コントロールの有効期間における最初の手順です。 ( Control から継承されます。) | |
Load | サーバー コントロールが Page オブジェクトに読み込まれると発生します。 ( Control から継承されます。) | |
PreRender | Control オブジェクトの読み込み後、表示を開始する前に発生します。 ( Control から継承されます。) | |
Unload | サーバー コントロールがメモリからアンロードされると発生します。 ( Control から継承されます。) |
Xml クラス
アセンブリ: System.Web (system.web.dll 内)
構文
解説
Xml コントロールを使用して、書式設定したり、または XSL Transformations を使用したりせずに、XML ドキュメントの内容を表示します。
表示する XML ドキュメントを指定するには、次の 3 つのプロパティのいずれかを設定します。これらの 3 つのプロパティは、表示できる各種の XML ドキュメントを表します。適切なプロパティを設定することによって、System.Xml.XmlDocument、XML 文字列、または XML ファイルを表示できます。XML ドキュメントを指定するためのプロパティを次の表に示します。
DocumentContent | |
DocumentSource |
メモ |
---|
XML ドキュメントを表示するには、1 つ以上の XML ドキュメント プロパティを設定する必要があります。複数の XML ドキュメント プロパティが設定されている場合は、最後のプロパティ セットで参照された XML ドキュメントが表示されます。他のプロパティのドキュメントは無視されます。 |
オプションで、2 つのプロパティのいずれかを設定して、XML ドキュメントを出力ストリームに書き込む前に書式設定する XSLT (XSL Transformation) スタイル シートを指定できます。この 2 つのプロパティは、XML ドキュメントの書式設定に使用できる異なる種類の XSL Transformation スタイル シートを表します。適切なプロパティを設定することによって System.Xml.Xsl.XslCompiledTransform オブジェクトまたは XSL Transformation スタイル シート ファイルを使用して XML ドキュメントを書式設定できます。XSL Transformation スタイル シートが指定されていない場合、XML ドキュメントは既定の書式で表示されます。XSL Transformation スタイル シートを指定するプロパティを次の表に示します。
指定した System.Xml.Xsl.XslTransform オブジェクトを使用して、XML ドキュメントを書式設定します。 | |
TransformSource | 指定した XSL Transformation スタイル シート ファイルを使用して、XML ドキュメントを書式設定します。 |
メモ |
---|
XSL Transformation スタイル シートはオプションです。Transform プロパティまたは TransformSource プロパティの設定は必要ではありません。両方の XSL Transformation スタイル シート プロパティが設定されている場合は、最後のプロパティ セットによって、XML ドキュメントの書式設定に使用する XSL Transformation スタイル シートが決定されます。その他のプロパティは無視されます。 |
Xml クラスは、TransformArgumentList プロパティも提供します。このプロパティでは、XSL Transformation スタイル シートにオプションの引数を指定できます。引数には、XSLT (XSL Transformations) パラメータまたは拡張オブジェクトを指定できます。
Topic | Location |
---|---|
チュートリアル : XML データを表示する Web ページの作成 | Visual Studio での ASP .NET Web アプリケーションの作成 |
チュートリアル : 変換による Web フォーム ページへの XML ドキュメントの表示 | Visual Studio での ASP .NET Web アプリケーションの作成 |
方法 : Web フォーム ページに XML Web サーバー コントロールを追加する | ASP .NET Web アプリケーションの作成 |
方法 : Web フォーム ページに XML Web サーバー コントロールを追加する (Visual Studio) | Visual Studio での ASP .NET Web アプリケーションの作成 |
方法 : XML Web サーバー コントロール内に XML データを読み込む | ASP .NET Web アプリケーションの作成 |
方法 : XML Web サーバー コントロール内の XML データを変換する | ASP .NET Web アプリケーションの作成 |
サンプル XML ファイルと XSL Transformation スタイル シートから XmlDocument オブジェクトおよび XslTransform オブジェクトを作成する方法を次のコード例に示します。これらのオブジェクトは、XML ドキュメントを表示するために XML コントロールで使用されます。
<!-- The following example demonstrates how to create XmlDocument and XslTransform objects from the sample XML and XSL Transform files. The objects are then used by the Xml control to display the XML document. Make sure the sample XML file is called People.xml and the sample XSL Transform file is called Peopletable.xsl. --> <%@ Page Language="VB" AutoEventWireup="True" %> <%@ Import Namespace="System.Xml" %> <%@ Import Namespace="System.Xml.Xsl" %> <html> <script runat="server"> Sub Page_Load(sender As Object, e As EventArgs) Dim doc As XmlDocument = New XmlDocument() doc.Load(Server.MapPath("people.xml")) Dim trans As XslTransform = new XslTransform() trans.Load(Server.MapPath("peopletable.xsl")) xml1.Document = doc xml1.Transform = trans End Sub </script> <body> <h3>Xml Example</h3> <form runat="server"> <asp:Xml id="xml1" runat="server" /> </form> </body> </html> <!-- For this example to work, paste the following code into a file named peopletable.xsl. Store the file in the same directory as your .aspx file. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/People"> <xsl:apply-templates select="Person" /> </xsl:template> <xsl:template match="Person"> <table width="100%" border="1"> <tr> <td> <b> <xsl:value-of select="Name/FirstName" />   <xsl:value-of select="Name/LastName" /> </b> </td> </tr> <tr> <td> <xsl:value-of select="Address/Street" /><br /> <xsl:value-of select="Address/City" /> , <xsl:value-of select="Address/State" /> <xsl:value-of select="Address/Zip" /> </td> </tr> <tr> <td> Job Title: <xsl:value-of select="Job/Title" /><br /> Description: <xsl:value-of select="Job/Description" /> </td> </tr> </table> </xsl:template> <xsl:template match="bookstore"> <!-- Prices and books --> <bookstore> <xsl:apply-templates select="book"/> </bookstore> </xsl:template> <xsl:template match="book"> <book> <xsl:attribute name="ISBN"> <xsl:value-of select="@ISBN"/> </xsl:attribute> <price> <xsl:value-of select="price"/> </price> <xsl:text> </xsl:text> </book> </xsl:template> </xsl:stylesheet> --> <!-- For this example to work, paste the following code into a file named people.xml. Store the file in the same directory as your .aspx file. <People> <Person> <Name> <FirstName>Joe</FirstName> <LastName>Suits</LastName> </Name> <Address> <Street>1800 Success Way</Street> <City>Redmond</City> <State>WA</State> <ZipCode>98052</ZipCode> </Address> <Job> <Title>CEO</Title> <Description>Wears the nice suit</Description> </Job> </Person> <Person> <Name> <FirstName>Linda</FirstName> <LastName>Sue</LastName> </Name> <Address> <Street>1302 American St.</Street> <City>Paso Robles</City> <State>CA</State> <ZipCode>93447</ZipCode> </Address> <Job> <Title>Attorney</Title> <Description>Stands up for justice</Description> </Job> </Person> <Person> <Name> <FirstName>Jeremy</FirstName> <LastName>Boards</LastName> </Name> <Address> <Street>34 Palm Avenue</Street> <City>Waikiki</City> <State>HI</State> <ZipCode>98052</ZipCode> </Address> <Job> <Title>Pro Surfer</Title> <Description>Rides the big waves</Description> </Job> </Person> <Person> <Name> <FirstName>Joan</FirstName> <LastName>Page</LastName> </Name> <Address> <Street>700 Webmaster Road</Street> <City>Redmond</City> <State>WA</State> <ZipCode>98073</ZipCode> </Address> <Job> <Title>Web Site Developer</Title> <Description>Writes the pretty pages</Description> </Job> </Person> </People> -->
<!-- The following example demonstrates how to create XmlDocument and XslTransform objects from the sample XML and XSL Transform files. The objects are then used by the Xml control to display the XML document. Make sure the sample XML file is called People.xml and the sample XSL Transform file is called Peopletable.xsl. --> <%@ Page Language="C#" AutoEventWireup="True" %> <%@ Import Namespace="System.Xml" %> <%@ Import Namespace="System.Xml.Xsl" %> <html> <script runat="server"> void Page_Load(Object sender, EventArgs e) { XmlDocument doc = new XmlDocument(); doc.Load(Server.MapPath("people.xml")); XslTransform trans = new XslTransform(); trans.Load(Server.MapPath("peopletable.xsl")); xml1.Document = doc; xml1.Transform = trans; } </script> <body> <h3>Xml Example</h3> <form runat="server"> <asp:Xml id="xml1" runat="server" /> </form> </body> </html> <!-- For this example to work, paste the following code into a file named peopletable.xsl. Store the file in the same directory as your .aspx file. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/People"> <xsl:apply-templates select="Person" /> </xsl:template> <xsl:template match="Person"> <table width="100%" border="1"> <tr> <td> <b> <xsl:value-of select="Name/FirstName" />   <xsl:value-of select="Name/LastName" /> </b> </td> </tr> <tr> <td> <xsl:value-of select="Address/Street" /><br /> <xsl:value-of select="Address/City" /> , <xsl:value-of select="Address/State" /> <xsl:value-of select="Address/Zip" /> </td> </tr> <tr> <td> Job Title: <xsl:value-of select="Job/Title" /><br /> Description: <xsl:value-of select="Job/Description" /> </td> </tr> </table> </xsl:template> <xsl:template match="bookstore"> <!-- Prices and books --> <bookstore> <xsl:apply-templates select="book"/> </bookstore> </xsl:template> <xsl:template match="book"> <book> <xsl:attribute name="ISBN"> <xsl:value-of select="@ISBN"/> </xsl:attribute> <price> <xsl:value-of select="price"/> </price> <xsl:text> </xsl:text> </book> </xsl:template> </xsl:stylesheet> --> <!-- For this example to work, paste the following code into a file named people.xml. Store the file in the same directory as your .aspx file. <People> <Person> <Name> <FirstName>Joe</FirstName> <LastName>Suits</LastName> </Name> <Address> <Street>1800 Success Way</Street> <City>Redmond</City> <State>WA</State> <ZipCode>98052</ZipCode> </Address> <Job> <Title>CEO</Title> <Description>Wears the nice suit</Description> </Job> </Person> <Person> <Name> <FirstName>Linda</FirstName> <LastName>Sue</LastName> </Name> <Address> <Street>1302 American St.</Street> <City>Paso Robles</City> <State>CA</State> <ZipCode>93447</ZipCode> </Address> <Job> <Title>Attorney</Title> <Description>Stands up for justice</Description> </Job> </Person> <Person> <Name> <FirstName>Jeremy</FirstName> <LastName>Boards</LastName> </Name> <Address> <Street>34 Palm Avenue</Street> <City>Waikiki</City> <State>HI</State> <ZipCode>98052</ZipCode> </Address> <Job> <Title>Pro Surfer</Title> <Description>Rides the big waves</Description> </Job> </Person> <Person> <Name> <FirstName>Joan</FirstName> <LastName>Page</LastName> </Name> <Address> <Street>700 Webmaster Road</Street> <City>Redmond</City> <State>WA</State> <ZipCode>98073</ZipCode> </Address> <Job> <Title>Web Site Developer</Title> <Description>Writes the pretty pages</Description> </Job> </Person> </People> -->
System.Web.UI.Control
System.Web.UI.WebControls.Xml
プラットフォーム
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
Xml コンストラクタ
アセンブリ: System.Web (system.web.dll 内)
構文
プラットフォーム
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
Xml プロパティ
パブリック プロパティ
関連項目
Xml クラスSystem.Web.UI.WebControls 名前空間
System.Xml.XmlDocument
System.Xml.Xsl.XslTransform
Document
DocumentContent
DocumentSource
TransformArgumentList
その他の技術情報
XML Web サーバー コントロールXml メソッド
パブリック メソッド
関連項目
Xml クラスSystem.Web.UI.WebControls 名前空間
System.Xml.XmlDocument
System.Xml.Xsl.XslTransform
Document
DocumentContent
DocumentSource
TransformArgumentList
その他の技術情報
XML Web サーバー コントロールXml メンバ
書式設定したり、または XSLT (Extensible Stylesheet Language Transformations) を使用したりせずに、XML ドキュメントを表示します。
パブリック コンストラクタ
パブリック プロパティ
名前 | 説明 | |
---|---|---|
DataBinding | サーバー コントロールがデータ ソースに連結すると発生します。(Control から継承されます。) | |
Disposed | サーバー コントロールがメモリから解放されると発生します。これは、ASP.NET ページが要求されている場合のサーバー コントロールの有効期間における最終段階です。(Control から継承されます。) | |
Init | サーバー コントロールが初期化されると発生します。これは、サーバー コントロールの有効期間における最初の手順です。(Control から継承されます。) | |
Load | サーバー コントロールが Page オブジェクトに読み込まれると発生します。(Control から継承されます。) | |
PreRender | Control オブジェクトの読み込み後、表示を開始する前に発生します。(Control から継承されます。) | |
Unload | サーバー コントロールがメモリからアンロードされると発生します。(Control から継承されます。) |
関連項目
Xml クラスSystem.Web.UI.WebControls 名前空間
System.Xml.XmlDocument
System.Xml.Xsl.XslTransform
Document
DocumentContent
DocumentSource
TransformArgumentList
その他の技術情報
XML Web サーバー コントロールWeblioに収録されているすべての辞書から.xmlを検索する場合は、下記のリンクをクリックしてください。
全ての辞書から.xmlを検索
- .xmlのページへのリンク