Login    |    Register

connect and contribute... Click here for further options





Articles

Current Articles | Categories | Search | Syndication

Thursday, September 07, 2006
MIDAS XML and Google Maps by Steve White
By Steve White @ 8:57 AM :: 3160 Views :: 0 Comments :: Computers and Archaeology
 
Article Pages:
Exporting data to the MIDAS XML standard

In the admin section of the application a single Category is selected and the IsFISH field can be edited. In order to edit, the relevant Thesaurus is first chosen from a drop-down list.

In order to edit, the relevant Thesaurus is first chosen from the drop-down list.

The selected drop-down value is then passed to an AJAX TreeView. Then the Term can be selected by clicking a node in the TreeView. The DataKey for each node is THE_TE_UID and once a node has been selected in the TreeView, clicking ‘Update’ will set the IsFISH bit field to 1 and update the THE_TE_UID in the GM_Category table.

Now we have a relationship in the database: GM_Category.THE_TE_UID = GM_EH_Terms.THE_TE_UID

To create the XML file for the Category, clicking ‘Create FISH XML’ will build an XML file in server memory and save the file to a directory on the server. The file is then instantly available to be downloaded or used by anyone.

The XML file is built by passing the CategoryID to a function like this:

Dim FileName, XMLPath, TType As String
Dim FType As String = ViewState("FISHType").ToString()
‘ FType is the name of the Thesurus selected in the drop-down
XMLPath = "../../XML/" FileName = Server.MapPath(XMLPath) & lblCatName.Text & ".xml"
Try
' which type of XML do we need
Select Case FType
Case 1 ' MONUMENT TYPE
TType = "eh_tmt2"
oUtil.BuildMonumentXML(CategoryID, FileName, TType)
Case 128 ' MDA OBJECT
TYPE Case 129 ' MAIN BUILDING MATERIALS
Case 143 ' MARITIME CRAFT TYPE
Case 225 ' AIRCRAFT TYPE
Case 365 ' DEFENCE OF BRITAIN
TType = "dob_98"
oUtil.BuildMonumentXML(CategoryID, FileName, TType)
Case 546 ' COMPONENTS
End Select
lblError.Text = "FISH XML has been generated"
Catch ex As Exception
lblError.Text = ex.ToString
End Try

Here we are sending the CategoryID, FileName and TType to a utility function that will do all the work for us.

Public Shared Sub BuildMonumentXML(ByVal CategoryID As Integer, ByVal FileName As String, ByVal TType As String)
Dim oDB As New GoogleMapDB
Dim DT As DataTable = oDB.GetCategoryItems(CategoryID).Tables(0)
‘ fill a DataTable with all Items in the Category
Try
' Use an XmlTextWriter to write the XML data to a string...
Dim sw As New StringWriter
Dim writer As New XmlTextWriter(FileName, Encoding.GetEncoding("ISO-8859-1"))
writer.Formatting = Formatting.Indented
writer.WriteStartDocument()
' write out
writer.WriteStartElement("monuments")
writer.WriteAttributeString
("xmlns", "http://www.heritage-standards.org/midas/schema/1.0")
writer.WriteAttributeString
("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance")
writer.WriteAttributeString
("xsi:schemaLocation", "http://www.heritage-standards.org/midas/schema/1.0 http://195.74.122.210/~fish/midas/schema/1.0/midas_monument.xsd")
' start
writer.WriteStartElement("meta")
' start title
writer.WriteStartElement("title")
writer.WriteString("Online Archaeology - UK Archaeology Resource data in MIDAS XML format")
writer.WriteEndElement()
...
End Sub

 

Previous Page | Next Page
Comments
Currently, there are no comments. Be the first to post one!
You must be logged in to post a comment. You can login here
Go to email Go to delicious.com Go to digg Go to technorati Go to reddit Go to stumbleupon Go to facebook Go to newsvine Go to simpy Go to google bookmarks Go to yahoo bookmarks Go to yahoo myweb Go to ask Go to slashdot Go to rawsugar Go to mister-wong Go to backflip Go to diigo Go to tailrank Go to live Go to twitter Go to fark Go to blogmarks Go to linkagogo Go to wink Go to ma.gnolia Go to bluedot Go to netvouz Go to blinklist Go to sphinn
Home · Connect · Contribute
Copyright 2006 - 2008 Online Archaeology   |   Terms of Use   |   Privacy Statement