Ryan Prins

INFO 320

Deliverable 3 – Info Diary

December 10, 2003


How did I get rid of the old XML data?


To get rid of the flower data that did not have the vendor information I first looked at all of the available data to see if the data that I needed existed in any of the files. After looking though this flower data I realized that they did not have the required flower vendor data that was recently required for the flowers to be see on our flower homepage. So, I made the decision to completely exclude this information from my flower data for this deliverable.


This process was done by taking the bill of ladings and the corresponding flower data XML files and passing them through my C# script to generate my output XML flower catalogue. I had to completely disregard this data from the 1st deliverable and just begin fresh with the data from the 2nd deliverable. This decision was made because the original data from the 1st deliverable was not adequate for what I needed to accomplish in this final deliverable. The data that is found in the 2nd deliverable was closely related, if not exactly, to what I needed for this final deliverable. Thus, I only went back one step to crate the new XML files of flower data.


This approach was only possible because of the similarity of the data that was found in each of the bills of lading and in the flower description data files. So, later down the line these files would need to be similar in fashion to be able to have me use them when creating the new XML files. By having this ability I would be able to only have to go back one step and I could just add to the past XML file. This would be the most efficient way of doing this since the process would have already been done in the past and there would be no reason to redo the whole process every time we got new data.


How did I make sure that each plant had an ‘s’ number and a supplier?


From the 2nd deliverable I had already had the ‘s’ number in my XML source, so this was not an issue for this deliverable. However, I did not anticipate the need to the supplier and so I needed to find a way to add them into the XML file.


The advantage that I had for this deliverable was that the XML sources were very similar in their structure so it was easy to pull out the data that I needed for the supplier. All I had to change for this deliverable was my method for making my XML file. What I ended up doing was creating a new method that would populate the XML data between the root and it’s closing tag. This method was defined in the following way:


public void parseShipmentXML(string shipmentFile, string flowerFile, string shipmentID, XmlTextWriter xwriter)


Example Usage:

string shipmentFile – “shipment453.xml”

string flowerFile – “DahliaDescriptions.xml

string shipmentID – “435-72”

XmlTextWriter xwriterxwriter


By having this method it provided me extra flexibility in creating the data that was contained within my XML file structure. I did not have this method in the last deliverable and I found this to be the easiest way to reuse my C# code while at the same time keeping the output the same. This method also incorporated the needed changes to add the vendor name to the XML file as an element and the need to have the bill of lading number contained as an attribute. This way we can easily print out the vendor and we can also see what bill of lading this item came from. Now, I did not include the date of the flowers because I feel that by having the bill of lading ID you should be able to backtrack by various means, maybe within the bill of lading, when the shipment was received. I feel that it is not needed to have the date in there since it is never needed and by at least having the reference to the bill of lading a backtracking reference can be made to find the appropriate date.


Adding the Calculator


By being given the Jscript code for the calculator there was not much work to do in adding the calculator to the sylesheet. All I ended up doing was changing the name of the calculator, as required, and placing it right below the table that contains all of the flower information on each specific color page. This process was not too terribly difficult to do, but nevertheless it needed to be completed.


New colors means new pages


One thing that I found out was that there were three new colors that were found in the new data. So, I made the decision to add a new color page to the layout. This was easily accomplished because I only have once stylesheet for all of my flower pages. I decided that the purple, violet, and blue colors would all end up on the newly created blue page. Creating this page was as easy as adding the following line of code to my C# script:




Data structure


From the last deliverable to this deliverable there was not much of a change in the way that I structured my data. The only major change that I made was the addition of a new element (vendor) and an attribute (shipment ID) to each individual flower. These changes were the only changes that I found needed to be made for the project to turn out the way that it was required. The changes were also minimal and it was easy enough to add them to my current structure from before. Also, I aimed to keep the small tree structure going by adding and element and an attribute instead of nesting the information deeper into the data tree. My theory on attributes and elements is that I feel attributes are more for sorting data and contains data that the user does not necessarily need to see, whereas the elements are data that the user would like to see provided to them. So, this is the idea that I tried to maintain when adding needed parts to my data structure.


Also, I had to make a change to my XML file containing my store information. All that needed to be added was the information that would be found on the newly created blue page. The information is in the same structure as before and all I needed to do was populate it with the correct information for that specific page.


More than one XML? How did you link them?


Like with my previous projects I used multiple XML files. I have one XML file that contains all of the store information (hours, address, etc…) and it also contains the basic information for the color specific pages (image source, blurbs, etc…). I found it better to keep them separate since I found that linking multiple XML files was easy to do. I utilized the document() function in XPath to link the documents together and to get the store information from that specific XML file. I also needed to combine XML files in my C# script when I was combining data from multiple sources. This process was fairly simple since it only required that I create more links in my script to get them together.


How have you use C# to manipulate XML programmatically?


By using the C# script I was able to combine multiple XML sources into a schema that would work for what I needed to do. This utilization of C# provided me an extremely easy way to combine multiple sources into one unified file for output to the user. Since the XML files that we used were very similar in their structure it was very easy to combine them into the one source that I needed. From the last deliverable to this deliverable I crated an additional method in my class to pass the XML files to for their parsing. The method that I called them from is seen below:


public void generateXML()






            // Establish the writer

            XmlTextWriter xwriter = new XmlTextWriter("Flowers_d3.xml", null);

            xwriter.Formatting = Formatting.Indented;




            Deliverable3 d3XML = new Deliverable3();

            d3XML.parseShipmentXML("shipment435.xml", "DahliaDescriptions.xml", "435-72", xwriter);

            d3XML.parseShipmentXML("shipment435.xml", "BegoniaDescriptions.xml", "435-72", xwriter);

            d3XML.parseShipmentXML("shipment435.xml", "ColeusDescriptions.xml", "435-72", xwriter);

            d3XML.parseShipmentXML("Shipment588.xml", "VerbenaDescriptions.xml", "588-76", xwriter);

            d3XML.parseShipmentXML("Shipment588.xml", "BellflowerDescriptions.xml", "588-76", xwriter);

            d3XML.parseShipmentXML("Shipment588.xml", "DianthusDescriptions.xml", "588-76", xwriter);


            // Close the writer






      catch (IOException e)






By having this method it was possible for me to pass the shipment XML file, the flower XML file, and the shipment number with great ease. I felt that this way I could minimize the re-creation of code by just adding another method. So, this cut down the coding by at least half and at the same time it provided me the same flexibility as it would have been if I copied and pasted the code but had all of these method calls in there differently. Furthermore, I could have created this to pass arguments given by the user if so desired since that would not have been to difficult to add. But, I choose to stick with the setup for it’s ease of use.


How does your information design address future, unknown, ad hoc requests for information?


The way that I have designed my XML data structure proves me the ability to easily add more information to the source if necessary. This is possible because of the way I treat the source file. I really only use the attributes for grouping qualities and the elements for the information that the user will see when the data is presented to them. An example of one flower is as follows:


<flower type="Dahlia" color="yellow" shipmentID="435-72">

            <vendor>Bishop Dahlias</vendor>

            <name>Bridgeview Aloha</name>


            <description>An eruption of molten yellow petals tipped red.</description>



As can been seen above the type="Dahlia" color="yellow" shipmentID="435-72" attributes are used solely for grouping or for information that will be useful for someone later down the line. The shipment ID is included in this because of the possibility of it being needed later down the line by someone for a reason that we may not really know of right now. Then the color and the type are also added so that the flowers can have the possibility to be grouped by the color or by type. Then the elements (vendor, name, id, and description) all contain information that the user will see when the visit the store homepage. This information may provide details on how to group them but the flowers are not grouped by these elements.


So, when new data comes into my structure it will be very easy to add elements or attributes to accommodate for the change in information. It will all depend on how the user wants the information to be stored in the structure and what they want the user to see and not to see. This will be the biggest decision to make. Once that decision is made the structure is there in a way that it can be filtered down to the already existing data quite easily.


What have you learned about the re-use of information so far?

I have learned that the re-use of information is very important for operations that will be growing in scale as time increases. This is because it is much easier to alter one file and let that change filter down, then to edit many files all because of one change. My projects have increased their re-used information each time. This was because I realized the benefits of doing this. I could alter one of my XML files and then the rest of my infrastructure would do the rest for me. From doing these projects it has taught me that sometimes you need to think larger than what you have in front of you and you need to be prepared for anything that my arise in the process of the project. In the case of the three deliverables it was evident that changes were needed to be made to accommodate for the requirements of the project. But, at the same time I was preparing for the next step without even knowing it. This helped me out in my projects without me even knowing it. This was an advantage to the re-use of information and all the benefits it provided me.