Avoiding Unicode issues when inserting XML into a SQL Database
Wednesday, December 29, 2010 at 5:00PM If you have to insert XML into a SQL Server (2005+) XML column, there's three ways of doing it...
Wednesday, December 29, 2010 at 5:00PM If you have to insert XML into a SQL Server (2005+) XML column, there's three ways of doing it...
Tuesday, February 16, 2010 at 4:57PM This is a small snippet showing an example of using a XmlTextWriter to produce Xml that validates.
Friday, January 1, 2010 at 5:16PM This is a small snippet for the basics of writing a ConfigurationHandler to read a configuration section from your web.config or app.config.
Wednesday, September 9, 2009 at 4:47PM Below is a small snippet showing how to format (or re-format) XML so it's indented. XML isn't stored in this humanly readable way in databases (or in System.XML's various writers), so this method makes the XML easier on the eyes.
/// <summary>
/// Formats the provided XML so it's indented and humanly-readable.
/// </summary>
/// <param name="inputXml">The input XML to format.</param>
/// <returns></returns>
public static string FormatXml(string inputXml)
{
XmlDocument document = new XmlDocument();
document.Load(new StringReader(inputXml));
StringBuilder builder = new StringBuilder();
using (XmlTextWriter writer = new XmlTextWriter(new StringWriter(builder)))
{
writer.Formatting = Formatting.Indented;
document.Save(writer);
}
return builder.ToString();
}
Tuesday, August 5, 2008 at 4:32PM Using serialization as persistent object store (in non bs-bingo: a database)
Tuesday, February 5, 2008 at 4:34PM This simplistic demo app from 2004 works as a simple XML browser, showing all XML nodes in an XML document in a treeview, the value of the node and all its attributes.
It uses a recursive method on the XML rather than lazy loading.
