XmlWriter.WriteString メソッド
アセンブリ: System.Xml (system.xml.dll 内)



WriteString は次を実行します。
-
0x-0x1F (空白文字 0x9、0x10、および 0x13 を除く) の範囲内にある文字値は、数字エンティティ (� から �x1F) に置き換えられます。
-
WriteString を属性値のコンテキスト内で呼び出すと、単一引用符および二重引用符は、それぞれ " と ' に置き換えられます。
たとえば、この入力文字列 test<item>test は次のように書き込まれます。
text が null 参照 (Visual Basic では Nothing) または String.Empty の場合、このメソッドは、データの内容を含まないテキスト ノードを書き込みます。

Option Explicit Option Strict Imports System Imports System.IO Imports System.Xml Public Class Sample Public Shared Sub Main() ' Create a writer to write XML to the console. Dim settings As XmlWriterSettings = new XmlWriterSettings() settings.Indent = true settings.OmitXmlDeclaration = true Dim writer As XmlWriter = XmlWriter.Create(Console.Out, settings) ' Write the book element. writer.WriteStartElement("book") ' Write the title element. writer.WriteStartElement("title") writer.WriteString("Pride And Prejudice") writer.WriteEndElement() ' Write the close tag for the root element. writer.WriteEndElement() ' Write the XML and close the writer. writer.Close() End Sub 'Main End Class 'Sample
using System; using System.IO; using System.Xml; public class Sample { public static void Main() { // Create a writer to write XML to the console. XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.OmitXmlDeclaration = true; XmlWriter writer = XmlWriter.Create(Console.Out, settings); // Write the book element. writer.WriteStartElement("book"); // Write the title element. writer.WriteStartElement("title"); writer.WriteString("Pride And Prejudice"); writer.WriteEndElement(); // Write the close tag for the root element. writer.WriteEndElement(); // Write the XML and close the writer. writer.Close(); } }
#using <System.Xml.dll> using namespace System; using namespace System::IO; using namespace System::Xml; int main() { // Create a writer to write XML to the console. XmlWriterSettings^ settings = gcnew XmlWriterSettings; settings->Indent = true; settings->OmitXmlDeclaration = true; XmlWriter^ writer = XmlWriter::Create( Console::Out, settings ); // Write the book element. writer->WriteStartElement( L"book" ); // Write the title element. writer->WriteStartElement( L"title" ); writer->WriteString( L"Pride And Prejudice" ); writer->WriteEndElement(); // Write the close tag for the root element. writer->WriteEndElement(); // Write the XML and close the writer. writer->Close(); return 1; }

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に収録されているすべての辞書からXmlWriter.WriteString メソッドを検索する場合は、下記のリンクをクリックしてください。

- XmlWriter.WriteString メソッドのページへのリンク