brain dust

The Absolute.

Friday, June 17, 2005

Framework Going Live in a week!

I have handed off the Framework to QA for testing. It's not 100% done to spec, but it's close. Probably around 90%. There is some polishing I need to do, but we have a client that we need it for that is launching on the 27th.

I have been playing around with writing several XML standards for use as templates. In one instance, in the DataXplorer I mentioned earlier, I am dynamically creating a query/filter form. That comes from an XML template that is stored in a database. That works great, but right now it is read only.

One of the other features I am implimenting is the ability to save "queries" in a relational table, based on that form template. So I ended up using the StringBuilder class along with the XmlTextWriter to build a string of xml. The XmlStringWriter has some very very nice methods in it. It is smart enough that if you use a WriteStartElement(string, data), that you can then autonomously call WriteAttributeString(key, data) and it will know what element it belongs to (because the element has not been closed yet, WriteEndElement).

So what I ended up with is a static method on my class that takes a control (in this case it's a panel that holds all the form controls) and recursively digs through it while building the XML document. Then what I end up with is a well formed XML document that looks something like this:


<?xml version="1.0" encoding="utf-8" ?>
<Preferences>
<Item ID="eval_calltime" Type="DropDownList" Value="=" />
<Item ID="calltime" Type="TextBox" Value="" />
<Item ID="eval_uii" Type="DropDownList" Value="like" />
<Item ID="uii" Type="TextBox" Value="137250082" />
<Item ID="eval_transtime" Type="DropDownList" Value="=" />
<Item ID="transtime" Type="TextBox" Value="" />
</Preferences>

Note that there is an Item element for each form element in the colleciton. All the form elements in this particular template use singluar selected valuies, but I also wrote it to support ListBox and CheckBoxList, which both support a collection of selectable items. Those end up with child nodes that look like this:


<Option ID="OptionValue1" Selected="True"></Option>
<Option ID="OptionValue2" Selected="False"></Option>
<Option ID="OptionValue3" Selected="True"></Option>

Then I am saving the preferences as an instance of the page, templateID and UserID. So, later down the line it will enable people to "Share" preferences with each other, which will come in handy when we roll out more complex templates.

On a lighter note, I have lost 17 lbs in the last 2 months! How? Lots of jogging :). I haven't changed my diet, except to try to limit overstuffing myself, but I have been jogging about 2-5 miles a day for the last 2 months. Well, the last three weeks I have managed to make at least 5 days a week :)

Happy Coding!

0 Comments:

Post a Comment

<< Home