0
을 사용하여이 코드를 처리하는 방법을 하나의 공백으로 변환되어있다이XML 공백 문제 내가 코드 문제 아래 사용하여 XML 파일을 생성하고 C#을
using System;
using System.IO;
using System.Xml;
public class Sample
{
public static void Main()
{
// Create the writer.
XmlTextWriter writer = null;
writer = new XmlTextWriter("c:\\ws.html", null);
// Write an element (this one is the root).
writer.WriteStartElement("p");
// Write the xml:space attribute.
writer.WriteAttributeString("xml", "space", null, "preserve");
// Verify that xml:space is set properly.
if (writer.XmlSpace == XmlSpace.Preserve)
Console.WriteLine("xmlspace is correct!");
// Write out the HTML elements. Insert white space
// between 'something' and 'Big'
writer.WriteString("something extra spacess in this line but not coming in xml i want this extra spaces");
writer.WriteWhitespace(" ");
writer.WriteElementString("b", "B");
writer.WriteString("ig");
// Write the root end element.
writer.WriteEndElement();
// Write the XML to file and close the writer.
writer.Close();
}
}
cdata에 대해 xmlelement로 추가하고 싶습니다. 그러나 작동하지 않지만 유용하지는 않습니다. – Yogesh