XmlElement.IsEmpty プロパティ
アセンブリ: System.Xml (system.xml.dll 内)

/** @property */ public boolean get_IsEmpty () /** @property */ public void set_IsEmpty (boolean value)
要素が短いタグ形式 "<item/>" でシリアル化される場合は true を返します。長い形式 "<item></item>" の場合は false を返します。 このプロパティを設定する場合、true に設定すると、要素の子が削除され、要素は短いタグ形式でシリアル化されます。false に設定した場合は、要素に内容があるかどうかにかかわらず、プロパティの値は変更されます。要素が空の場合は、長い形式でシリアル化されます。 このプロパティは、DOM (Document Object Model) に対する Microsoft 拡張機能です。

このプロパティは、DOM (Document Object Model) の Microsoft 拡張機能です。

Imports System Imports System.Xml public class Sample public shared sub Main() Dim doc as XmlDocument = new XmlDocument() doc.LoadXml("<book>" & _ " <title>Pride And Prejudice</title>" & _ " <price/>" & _ "</book>") Dim currNode as XmlElement currNode = CType (doc.DocumentElement.LastChild, XmlElement) if (currNode.IsEmpty) currNode.InnerXml="19.95" end if Console.WriteLine("Display the modified XML...") Console.WriteLine(doc.OuterXml) end sub end class
using System; using System.Xml; public class Sample { public static void Main() { XmlDocument doc = new XmlDocument(); doc.LoadXml("<book>"+ " <title>Pride And Prejudice</title>" + " <price/>" + "</book>"); XmlElement currNode = (XmlElement) doc.DocumentElement.LastChild; if (currNode.IsEmpty) currNode.InnerXml="19.95"; Console.WriteLine("Display the modified XML..."); Console.WriteLine(doc.OuterXml); } }
#using <System.Xml.dll> using namespace System; using namespace System::Xml; int main() { XmlDocument^ doc = gcnew XmlDocument; doc->LoadXml( "<book> <title>Pride And Prejudice</title> <price/></book>" ); XmlElement^ currNode = dynamic_cast<XmlElement^>(doc->DocumentElement->LastChild); if ( currNode->IsEmpty ) currNode->InnerXml = "19.95"; Console::WriteLine( "Display the modified XML..." ); Console::WriteLine( doc->OuterXml ); }
import System.*; import System.Xml.*; public class Sample { public static void main(String[] args) { XmlDocument doc = new XmlDocument(); doc.LoadXml("<book>" + "<title>Pride And Prejudice</title>" + "<price/>" + "</book>"); XmlElement currNode = (XmlElement)doc.get_DocumentElement().get_LastChild(); if (currNode.get_IsEmpty()) { currNode.set_InnerXml("19.95"); } Console.WriteLine("Display the modified XML..."); Console.WriteLine(doc.get_OuterXml()); } //main } //Sample

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からXmlElement.IsEmpty プロパティを検索する場合は、下記のリンクをクリックしてください。

- XmlElement.IsEmpty プロパティのページへのリンク