Category Archives: XML

Make a temperature forecast in C#

The example Get weather forecast data in C# explains how to read weather forecast data from OpenWeatherMap. This example uses that data to list the forecast’s temperatures. The forecast data has (in part) the following structure. <weatherdata> … <forecast> <time … Continue reading

Posted in internet, interoperability, web, XML | Tagged , , , , , , , , , , , , | 5 Comments

Get weather forecast data in C#

There are many sites that offer weather condition and weather forecast services. All of the ones I found required you to have a developer key, although most of them have a free membership that works for a simple program like … Continue reading

Posted in internet, interoperability, web, XML | Tagged , , , , , , , , , , | Leave a comment

Load a WPF TreeView control from an XML file in C#

The post Load a TreeView control from an XML file in C# explains how you can display XML data in a Windows Forms TreeView control. This example does something similar for a WPF project. In keeping with the unofficial WPF … Continue reading

Posted in controls, wpf, XAML, XML | Tagged , , , , , , , , , , , , | 3 Comments

Format an XML file so it looks nice in C#

This example shows how to format an XML file. When the computer processes an XML file, it doesn’t care about formatting. It doesn’t need indentation and new lines to make the file look nice. As long as the file is … Continue reading

Posted in strings, XML | Tagged , , , , , , , , , , | Leave a comment

Use objects to make an XML document in C#

This example shows how to use the XML DOM (document object model) to make an XML document. There are several ways to build an XML document. The example Build a formatted XML document in memory in C# shows one way … Continue reading

Posted in XML | Tagged , , , , , , , , , , | 1 Comment

Build a formatted XML document in memory in C#

This example uses an XmlTextWriter to build a formatted XML document in memory and displays it in a text box. When you click the Go button, the following code executes. private void btnGo_Click(object sender, EventArgs e) { MemoryStream memory_stream = … Continue reading

Posted in XML | Tagged , , , , , , , , , , , , , , | 1 Comment

Load a TreeView control from an XML file in C#

This example shows how to load a TreeView control with XML data. An XML (eXtensible Markup Language) file is a simple file that stores tokens in a hierarchical manner. It doesn’t do anything except hold data. Programs can load and … Continue reading

Posted in controls, XML | Tagged , , , , , , , , , | 6 Comments

A plea for help: Tell me what you want to see in my blog!

I get remarkably little feedback from my blog. I track post views and know that I have 857 Twitter followers, but people rarely let me know if they particularly like or dislike a post. That makes it hard for me … Continue reading

Posted in ADO.NET, algorithms, animation, API, challenges, combinatorics, controls, cryptography, curve fitting, database, extension methods, files, fonts, fractals, games, geometry, globalization, graphics, internationalization, LINQ, localization, mathematics, Office, phone, printing, reflection, registry, serialization, threading, transformations, user interface, Word, wpf, XAML, XML | 13 Comments

Use XML “literals” in C#

Visual Basic has XML literals so you can include them directly in your code as in the following example. Dim employees As XElement = <employees> <employee firstname=”Terry” lastname=”Pratchett”/> <employee firstname=”Glen” lastname=”Cook”/> <employee firstname=”Tom” lastname=”Holt”/> <employee> <firstname>Rod</firstname> <lastname>Stephens</lastname> </employee> </employees> C# … Continue reading

Posted in strings, XML | Leave a comment