![]() |
|
Spaces home John Stewien's Road To S...ProfileFriendsFilesMore ![]() | ![]() |
John Stewien's Road To Somewhere ElseProgramming in WPF (.NET 3.0) and moving to Taiwan
7/15/2008 C# Formatting XmlSerializer Output
So today I’m writing an app that loads and writes data to and from XML files, Excel Files, and Oracle Databases. An integration application you might say. Naturally I picked C# for the job as the thought of debugging a big hairy Perl script didn’t fill me with joy. Unfortunately my work PC only has Visual Studio 2003 on it, but what can you do? One of the things I wanted to do was load an XML file, modify some parts of it, and then write it out again with just the parts changed that I wanted changed. Fortunately I had an XSD for the XML file so I used the VS2003 xsd.exe utility to convert it to a C# .cs file. Unfortunately it did a terrible job and created C# class hierarchies that were a bit messy. So I went through and hand modified the C# code until I ended up with something I liked. Right, I deserialized the XML file, modified the data, and wrote it out again just using the simple XmlSerializer class in C#. What I wanted was this header: <?xml version="1.0" encoding="UTF-8" ?> What I got was this: <?xml version="1.0"?> And to top it off the output file had double space as the indentation instead of tabs. To fix all this first of all I modified the serializable class to generate the noNamespaceSchemaLocation attribute: [System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
Then I changed the serialization to encode in UTF-8, indent using single tab spaces, and set the namespace the way I wanted it set: XmlSerializer serializer = newXmlSerializer(typeof(Xml.ReferenceData)); Then I got the output I wanted. 7/6/2008 Office DesignWe've been thinking about office design for the new company. There's a few things that come to mind: People have engaged discussions when doing something else, for example when playing golf business executives will often have very productive discussions. In light of this I'm thinking that the meeting room should have a pool table (8-ball, 9-ball, billiards, snooker, etc), so that people can play a game while having productive discussions. Work stress can lead to making mistakes, people need to feel relaxed so that they can concentrate on the job, therefore I think the office should have hot tubs (spas, artificial hot springs), for people to work in, this would also be good for meetings, however we will need to find some floating waterproof laptops. We also needs plants, heating, cooling, a location that is near a Starbucks, near the underground train, etc 7/4/2008 More Pictures From AdelaideHere are my parents waiting for me at the airport. Jasmine arrived with Violet from Taiwan, and I arrived from Perth.
Here's Jasmine at lunch with a friend, who is also my best friend's fiancee:
Here I am with Violet and my best friend Ian:
Here are Violet and I feeding the swans:
Here's Jasmine, Violet and I at the Torrens River, Adelaide:
Here I am pushing Violet along in North Adelaide:
What the?
Here's my best friend with his fiancee from Taiwan:
Here's Violet waiting for lunch:
After lunch here's Violet with her great grandmother: 7/3/2008 Baby StuntViolet climbing the couch. Violet was not harmed as a result of this stunt. The minor harm that occurred later was due to something else and was not stunt related.
Trip to AdelaideWent on a trip to Adelaide to fix up some things, and to catch up with family and friends. Unfortunately I didn't have time to catch up with all my friends. Jasmine, Violet and I are now all on the same medicare card though. For some reason it seems like a nice feeling to pull out my medicare card and see the names of my family all on there.
Here's all my immediate family including my sister's family unit:
Violet got to meet her cousins for the first time:
She's a big baby, but hopefully she won't get as big as her grandfather:
Here's a picture of my beautiful wife and daughter together:
While in Adelaide we travelled about by bus and train:
Lunch times can be tricky:
A high chair is recommended:
Got to watch out at the pub for baby grabbing things:
At the end of the day a bath is good:
Then maybe watch some tv:
We had some fun times:
Note the teeth:
But at the end of the day a rest is good:
|
|||||||||||||||||||
|
|