Creating a SiteMap of your site - the really hard way.

There is a lot of talk on the web about blogs at present (aka Weblogs). Google has just started a Sitemap search engine that you can submit a sitemap.xml  file for submission to aid searching of your site. Bear with me, this is all new to me.

As far as I understand all of this technology, you just need an xml file, with a few specific tags added. As this is a new site, with only a few pages at present, I thought I would use this site as a simple example.

Take a look at Blog-Essex.xml which is simply an xml file starting with the

<?xml version="1.0" ?>
- <rss version="2.0">
- <channel>
  <title>Kevans Essex Blog</title>
  <link>http://essex1841.com/</link>
  <description>Essex census, genealogy , parish records, births, marriages, deaths, christenings, strong in 1841 Victorian period plus Suffolk.</description>
  <language>en-UK</language>
  <generator>BlogRSS.java</generator>
- <item>
  <title>BorgenRadio1.wma</title>
  <link>http://dirtiboy.com/Borgen/BorgenRadio1.wma</link>
  <description>Borgen/BorgenRadio1.wma</description>
  <pubDate>04/06/2005 21:42</pubDate>
  </item>

and ends ::

- <item>
  <title>WorldDevelopmentBank.htm</title>
  <link>http://dirtiboy.com/WorldDevelopmentBank.htm</link>
  <description>World Development Bank strategy for helping developing countries</description>
  <pubDate>07/06/2005 09:44</pubDate>
  </item>
  </channel>
  </rss>

 

 

Notice, this is a straightforward xml file that opens and closes every tag.

i.e <item> lah lah lah </item>

Inside the item tag are tags for title, link, description and pubDate [that stands for publication date, not when I was last down the Pub]

If you look at the top and end of the file, I open the <rss> and channel tags, and later close them.

The first entry is    <?xml version="1.0" ?>

So, in summary, we have

<?xml version="1.0" ?>
- <rss version="2.0">
- <channel>
  <title></title>
  <link></link>
  <description></description>
  <language></language>
  <generator></generator>
- <item>
  <title></title>
  <link></link>
  <description></description>
  <pubDate></pubDate>
  </item>
  </channel>
  </rss>

 

As this summary is completely empty, you could use <title/> instead of <title></title> but that is not the point of this exercise. There are lots of good examples, better than this, which talk you through the detail of what has been covered so far, but these all point you to 'pay me' sites for the next steps. Why pay, when you can do it yourself for free?

 

So, how do we produce this file, and what is the point of it?

Here are the criteria for what we require:

We then need a program to read in this list, and create the  .xml file, as listed

Then add this .xml file to our webserver

Then add a xml.gif picture to our main / index page pointing to this file

That will do for now - it is as far as I have got.

Create the data of the web pages [I go through each step I did in detail - just read]

 

OK, so you are completely lost now - me too! I keep thinking of other bits you need.

short cut - to get you started.

Just start mysql, and create a table with four columns. I use column names of title, link, description and pubDate - but this does not really matter. Make then all text fields, I am not using any date fields, or anything fancy. I tend to use the varchar, which means the field ends up as big as the number of characters.

In this example, I am actually using a local copy of mysql, and create a database called blog.

Mysql is completely free, and runs on all operating systems, and is very easy to install.

[For the less squeamish, get a copy of Apache, php, and phpMyAdmin installed - more to follow on this - oh, you are going to need a java jdk installed too, to run this example]

Start mysql, open a command window and start a mysql session, using the word mysql

mysql > create database blog;

mysql > use blog;

mysql > create table bloggs (title varchar(100), link varchar(100), description varchar(250), pubDate(250));

You should now have the mysql table created.

If you have the relevant data needed in an excel spreadsheet, and have saved it as a csv file, which is just a text file that also opens in excel; you can add this data to mysql using the following mysql command:

LOAD DATA LOCAL INFILE 'data.csv' INTO TABLE blog.bloggs;

This means load the data from your csv file, here called data,csv into the table bloggs, which exists in the database blog.

You could also use this example :

LOAD DATA LOCAL INFILE 'c:\\blogs\\data.csv' INTO TABLE blog.bloggs;

which is the same, but specifies where the data.csv file is to be found - notice the double \\ which are needed, else it fails.

OK, I am presuming you now have some data in the bloggs table. Here comes the cleverest part. This is going to use a clever java program, well actually it is quite simple, but really powerful.

Let me presume, just for now, that you have mysql running, and java installed on your machine. The java must be the jdk version, so that you can compile java programs.

You will need one last file, I call it the  mysql.jar for convenience, but it is a set of java classes in a java executable file, that you will need to add to your classpath to contact mysql from any java program. Here is a version of mysql.jar that you can download.

You need to download it and save it to any area on your c: drive, I have various folders for this useful stuff, a c:/download folder is a good idea. Save everything there.

 

Now you need the java files - they are here - ConnectionManager.java and BlogRSS.java - save them in the c:/download  folder in the first instance

Download both of these, and open in a good text editor, textpad is good, and free to download and use.

If nothing works, download this very simple program, to do some testing. It is called testAbit.java and is a very useful way of checking whether you can access the mysql database using java. Save it in the c:/download  folder.

To run any of these java programs, you do need the java jdk  installed, and the mysql.jar on your classpath. e.g.

Save this simple text as run1.bat in  the c:/download  folder

javac -classpath .;c:\download\mysql.jar

c:\download\testAbit.java

If it complains. make sure you have the   java jdk  installed correctly.

 

MORE tomorrow