Xml クラスとは? わかりやすく解説

Xml クラス

書式設定したり、または XSLT (Extensible Stylesheet Language Transformations) を使用したりせずに、XML ドキュメント表示します

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

解説解説

Xml コントロール使用して書式設定したり、または XSL Transformations使用したりせずに、XML ドキュメント内容表示します

表示する XML ドキュメント指定するには、次の 3 つのプロパティいずれか設定します。これらの 3 つのプロパティは、表示できる各種XML ドキュメント表します適切なプロパティ設定することによって、System.Xml.XmlDocument、XML 文字列、または XML ファイル表示できますXML ドキュメント指定するためのプロパティ次の表に示します

オプションで、2 つプロパティいずれか設定してXML ドキュメント出力ストリーム書き込む前に書式設定する XSLT (XSL Transformation) スタイル シート指定できます。この 2 つプロパティは、XML ドキュメント書式設定使用できる異な種類XSL Transformation スタイル シート表します適切なプロパティ設定することによって System.Xml.Xsl.XslCompiledTransform オブジェクトまたは XSL Transformation スタイル シート ファイル使用して XML ドキュメント書式設定できますXSL Transformation スタイル シート指定されていない場合XML ドキュメント既定書式表示されます。XSL Transformation スタイル シート指定するプロパティ次の表に示します

Xml クラスは、TransformArgumentList プロパティ提供します。このプロパティでは、XSL Transformation スタイル シートオプション引数指定できます引数には、XSLT (XSL Transformations) パラメータまたは拡張オブジェクト指定できます

TopicLocation
チュートリアル : 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"
 />
                  &#160;
                  <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" />
                  &#160;
                  <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>

-->
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
   System.Web.UI.Control
    System.Web.UI.WebControls.Xml
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Xml メンバ
System.Web.UI.WebControls 名前空間
System.Xml.XmlDocument
System.Xml.Xsl.XslTransform
Document
DocumentContent
DocumentSource
TransformArgumentList
その他の技術情報
XML Web サーバー コントロール



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Xml クラス」の関連用語

Xml クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Xml クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS