C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Next: In this example we see that a span tag is opened and closed by the HtmlTextWriter.
C# program that writes HTML
using System;
using System.IO;
using System.Web.UI;
class Program
{
static void Main()
{
using (StringWriter stringWriter = new StringWriter())
using (HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter))
{
htmlWriter.RenderBeginTag(HtmlTextWriterTag.Span);
htmlWriter.Write("Perls");
htmlWriter.RenderEndTag();
Console.WriteLine(stringWriter);
}
}
}
Output
<span>Perls</span>
Tip: The .NET Framework provides rich support for XML, including classes in System.Xml and System.Xml.Linq.
Example XML file:
<?xml version="1.0"?>
<tag>Test</tag>
C# program that loads example XML file
using System;
using System.Xml.Linq;
class Program
{
static void Main()
{
// Load the XML.
XElement element = XElement.Load("C:\\text.xml");
// Write text value.
Console.WriteLine(element.Value);
}
}
Output
Test
XmlTextWriter: You can also find information about XmlTextWriter and XmlTextReader on this site.
XmlTextWriterXmlTextReaderQuote: Extensible Markup Language, abbreviated XML, describes a class of data objects called XML documents.. (The World Wide Web Consortium).