My name is Edward Tanguay. I'm an American software and web developer living and working in Berlin, Germany.
8 hours ago: Here's a use-case for datapod format, recording human-readable data that later can be used as a datasource: http://is.gd/eSsLg @pholdings.
9 hours ago: "Subscriptions are available to U.S. addresses only." http://www.highlights.com another global economy #fail.
9 hours ago: "Subscriptions are available to U.S. addresses only." http://www.highlights.com another global #fail.
11 hours ago: My notes on podcast with author Aimee Bender's Lemoncake book, "a normal kid punished by expectations of giftedness": http://is.gd/eSsLg.
12 hours ago: Interesting: "one page per book": http://openlibrary.org/about.
12 hours ago: Another after-work 8K, did 5K in 23:33, getting cooler here as #berlin #marathon approaches: http://is.gd/eSp95.
yesterday: C# CODE EXAMPLE: Extension method for checking regex in one line: http://is.gd/eQzyg.
yesterday: New podcast source: "I don't want to put you to sleep, but I want to be as rich, and rewarding, and resident as a dream.":http://is.gd/eQrdC.
yesterday: An intense colin marshall interview with michael silverblatt on the art of interviewing & more: http://is.gd/eQqve (search for "blatt").
yesterday: The stackexchange site for wordpress is up: get your answers / establish your reputation @cottonr http://wordpress.stackexchange.com.
2 days ago: "I've always felt that any time you can use a tuple, you should use a struct.": http://is.gd/eQm9V.
C# CODE EXAMPLE created on Thursday, June 25, 2009 permalink
Four ways to create an XML file
Here are four ways to create the same XML string that I needed for an application: string concatenation, XmlWriter, LINQ-to-XML, in reverse order of preference (plus an example using XML literals which Jim Wooley posted on his site along with some notes on the dangers of string concatenation). These code samples assume an object called DataType which is not included in the code, so the code isn't executable as is, but I just wanted to record the syntax of each way for further reference. Notice the Enumerable.Range(1, 3).Select on the LINQ-to-XML functions as a for loop.
String Concatentation:
    StringBuilder sb = new StringBuilder();
    sb.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine);

    sb.Append(String.Format("<{0}>{1}", _pluralCamelNotation, Environment.NewLine));
    for (int index = 0; index < 3; index++)
    {
        sb.Append(String.Format("\t<{0}>{1}", _singularCamelNotation, Environment.NewLine));
        foreach (DataType dataType in _allDataTypes)
        {
            sb.Append(String.Format("\t\t<{0}>{2}</{0}>{1}", dataType.CamelCaseNotation, Environment.NewLine, dataType.GetDummyData()));
        }
        sb.Append(String.Format("\t</{0}>{1}", _singularCamelNotation, Environment.NewLine));
    }
    sb.Append(String.Format("</{0}>{1}", _pluralCamelNotation, Environment.NewLine));

XmlWriter:
            XmlWriterSettings settings = new XmlWriterSettings();
            settings.NewLineHandling = NewLineHandling.Entitize;
            settings.Indent = true;
            settings.IndentChars = "\t";

            StringBuilder sb = new StringBuilder();
            using (XmlWriter xw = XmlWriter.Create(sb, settings))
            {
                xw.WriteStartDocument();
                xw.WriteStartElement(_pluralCamelNotation);
                for (int i = 0; i < 3; i++)
                {
                    xw.WriteStartElement(_singularCamelNotation);
                    foreach (DataType dataType in _allDataTypes)
                    {
                        xw.WriteElementString(dataType.CamelCaseNotation, dataType.GetDummyData());
                    }
                    xw.WriteEndElement();
                }
                xw.WriteEndElement();
                xw.WriteEndDocument();
                xw.Close();
            }
            return sb.ToString();

XML Literals (VB.NET):

        Dim doc = <?xml version="1.0"?>
                    <<%= _pluralCamelNotation %>>
                        <%= From i In Enumerable.Range(1, 3) _
                            Select <<%= _singluarNotation %>>
                                     <%= From t In _allDataTypes _
                                         Select <<%= t.CamelCaseNotation %>>
                                             <%= t.GetDummyData %></> %>
                                 </> %>
                    </>

LINQ-to-XML:
            XDocument doc = new XDocument(
                new XDeclaration("1.0", null, null),
                new XElement(_pluralCamelNotation,
                    Enumerable.Range(1, 3).Select(
                        i => new XElement(_singularCamelNotation,
                            _allDataTypes.Select(
                                dataType => new XElement(
                                    dataType.CamelCaseNotation,
                                    dataType.GetDummyData())
                            )
                    ))));
            return doc.ToString();
need markup?