Xml.Document プロパティ
アセンブリ: System.Web (system.web.dll 内)
構文
<ObsoleteAttribute("The recommended alternative is the XPathNavigator property. Create a System.Xml.XPath.XPathDocument and call CreateNavigator() to create an XPathNavigator. http://go.microsoft.com/fwlink/?linkid=14202")> _ Public Property Document As XmlDocument
[ObsoleteAttribute("The recommended alternative is the XPathNavigator property. Create a System.Xml.XPath.XPathDocument and call CreateNavigator() to create an XPathNavigator. http://go.microsoft.com/fwlink/?linkid=14202")] public XmlDocument Document { get; set; }
[ObsoleteAttribute(L"The recommended alternative is the XPathNavigator property. Create a System.Xml.XPath.XPathDocument and call CreateNavigator() to create an XPathNavigator. http://go.microsoft.com/fwlink/?linkid=14202")] public: property XmlDocument^ Document { XmlDocument^ get (); void set (XmlDocument^ value); }
/** @property */ public XmlDocument get_Document () /** @property */ public void set_Document (XmlDocument value)
Xml コントロール内に表示される System.Xml.XmlDocument。
Xml コントロール内に表示される XML ドキュメントは、次の 3 つの方法のいずれかで指定されます。適切なプロパティを設定することによって、System.Xml.XmlDocument オブジェクト、XML 文字列、または XML ファイルを指定できます。Document プロパティは、コントロール内に表示される (XML ドキュメントを表す) System.Xml.XmlDocument を指定するために使用します。
サンプル 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> -->
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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
XmlDocument プロパティ
パブリック プロパティ
名前 | 説明 | |
---|---|---|
Attributes | このノードの属性を格納している XmlAttributeCollection を取得します。 ( XmlNode から継承されます。) | |
BaseURI | オーバーライドされます。 現在のノードのベース URI を取得します。 | |
ChildNodes | ノードのすべての子ノードを取得します。 ( XmlNode から継承されます。) | |
FirstChild | ノードの最初の子を取得します。 ( XmlNode から継承されます。) | |
HasChildNodes | このノードに子ノードがあるかどうかを示す値を取得します。 ( XmlNode から継承されます。) | |
InnerText | ノードとそのすべての子の連結された値を取得または設定します。 ( XmlNode から継承されます。) | |
InnerXml | オーバーライドされます。 現在のノードの子を表すマークアップを取得または設定します。 | |
IsReadOnly | オーバーライドされます。 現在のノードが読み取り専用かどうかを示す値を取得します。 | |
Item | オーバーロードされます。 指定した子要素を取得します。 ( XmlNode から継承されます。) | |
LastChild | ノードの最後の子を取得します。 ( XmlNode から継承されます。) | |
LocalName | オーバーライドされます。 ノードのローカル名を取得します。 | |
Name | オーバーライドされます。 ノードの限定名を取得します。 | |
NamespaceURI | このノードの名前空間 URI を取得します。 ( XmlNode から継承されます。) | |
NextSibling | このノードの直後のノードを取得します。 ( XmlNode から継承されます。) | |
NodeType | オーバーライドされます。 現在のノードの種類を取得します。 | |
OuterXml | このノードとそのすべての子ノードを表すマークアップを取得します。 ( XmlNode から継承されます。) | |
OwnerDocument | オーバーライドされます。 現在のノードが属する XmlDocument を取得します。 | |
ParentNode | オーバーライドされます。 このノードの親ノード (親を持つノードの場合) を取得します。 | |
Prefix | このノードの名前空間プリフィックスを取得または設定します。 ( XmlNode から継承されます。) | |
PreviousSibling | このノードの直前のノードを取得します。 ( XmlNode から継承されます。) | |
SchemaInfo | オーバーライドされます。 ノードの PSVI (Post-Schema-Validation-Infoset) を返します。 | |
Value | ノードの値を取得または設定します。 ( XmlNode から継承されます。) | |
XmlResolver | 外部リソースを解決するために使用する XmlResolver を設定します。 |
- Xml.Document プロパティのページへのリンク