Monday, July 16, 2007

Navigating XML and Unknown Injurys

I learnt something about readingXML file's today, using VB.net and XPath.
I had an xml file, and some of the data in it were tags similar to this:

<CustomField name ="title" type="str">This is a Title</CustomField>
<CustomField name ="titleDate" type="dte">01/01/2007</CustomField>

So, couldn't just navigate to the CustomField tag, as there was more than one of them. I've never really gone to much into how to navigate round an XML file, i've always just gone straight to the node I was interested in and pulled out the data.

This time, I had to delve more into the XPath navigator. I found out I could use the following in my XPathNodeIterator, to return me only nodes that contained the attribute title:

/Story/StoryData/CustomField[@Name="Title"]

I could then iterate round all the retuned nodes and process the data. Some of the XML processing tools and classes in .Net do take a bit of time to get your head round, but they do seam to work well and are very fast.

On another note, I went over on my ankle playing football (soccer if your in the US) on Sunday, it swelled up pretty bad so I went to the hospital.
They sent me for an x-ray, and it turned out it was just badly sprained this time, but i've broken or chipped it before and didn't notice. How the hell did that happen!
I'm now stuck at home for a couple of boring days to let it heel a bit, they said i shouldn't even drive for a week. Not bloody likely!

Got another article on aspfree.com its about controlling Windows 2003 fax services through an application, you can read it here

No comments: