Index: trunk/autoquest-htmlmonitor-test/src/test/java/de/ugoe/cs/autoquest/htmlmonitor/HtmlMonitorServerTest.java
===================================================================
--- trunk/autoquest-htmlmonitor-test/src/test/java/de/ugoe/cs/autoquest/htmlmonitor/HtmlMonitorServerTest.java	(revision 1000)
+++ trunk/autoquest-htmlmonitor-test/src/test/java/de/ugoe/cs/autoquest/htmlmonitor/HtmlMonitorServerTest.java	(revision 1069)
@@ -56,4 +56,9 @@
      * 
      */
+    private HtmlGUIElement guiStructure;
+
+    /**
+     * 
+     */
     private String eventHandlingError;
 
@@ -97,18 +102,35 @@
     @Test
     public void testSimpleMessage() throws Exception {
+        String clientId = "123";
+        
         String message =
             "{" +
             "  \"message\": {" +
             "    \"clientInfos\": {" +
-            "      \"clientId\":\"123\"," +
+            "      \"clientId\":\"" + clientId + "\"," +
             "      \"userAgent\":\"Agent\"," +
             "      \"title\":\"Title\"," +
             "      \"url\":\"http://host/path\"" +
             "    }," +
+            "    \"guiModel\": {" +
+            "      \"tagName\":\"html\"," +
+            "      \"index\":\"0\"," +
+            "      \"children\":" +
+            "      [ {" +
+            "          \"tagName\":\"head\"," +
+            "          \"index\":\"0\"," +
+            "        }," +
+            "        {" +
+            "          \"tagName\":\"body\"," +
+            "          \"htmlId\":\"gsr\"," +
+            "        }" +
+            "      ]" +
+            "    }," +
             "    \"events\":" +
             "    [ {" +
             "        \"time\":\"12345\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)\"," +
-            "        \"eventType\":\"onunload\"" +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)\"," +
+            "        \"eventType\":\"onclick\"" +
+            "        \"coordinates\": [\"194\", \"7\"]" +
             "      }" +
             "    ]" +
@@ -122,19 +144,34 @@
         }
         
+        // check the GUI structure
+        HtmlGUIElement parent = null;
+        HtmlGUIElement element = guiStructure;
+        
+        assertGuiElement(element, HtmlServer.class, parent, 1);
+        
+        parent = element;
+        element = parent.getChildren().get(0);
+        assertGuiElement(element, HtmlDocument.class, parent, 1);
+        
+        HtmlDocument document = (HtmlDocument) element;
+        
+        parent = element;
+        element = parent.getChildren().get(0);
+        assertGuiElement(element, HtmlPageElement.class, parent, 2);
+
+        parent = element;
+        element = parent.getChildren().get(0);
+        assertGuiElement(element, HtmlPageElement.class, parent, 0);
+        element = parent.getChildren().get(1);
+        assertGuiElement(element, HtmlPageElement.class, parent, 0);
+
+        // check the event
         assertNotNull(events);
         assertEquals(1, events.length);
         
-        assertEquals(new Long(12345), events[0].getTime());
-        assertEquals("/html[0]/body(id=gsr)", events[0].getPath());
-        assertEquals("onunload", events[0].getEventType());
-        
-        assertNull(events[0].getKey());
-        assertNull(events[0].getScrollPosition());
-        assertNull(events[0].getCoordinates());
-        
-        assertEquals("Title", events[0].getClientInfos().getTitle());
-        assertEquals("Agent", events[0].getClientInfos().getUserAgent());
-        assertEquals("http://host/path", events[0].getClientInfos().getUrl().toString());
-        assertEquals("123", events[0].getClientInfos().getClientId());
+        assertEvent(0, 12345, "/html[0]/body(htmlId=gsr)", element, document, "onclick",
+                    null, null, new Integer[] {194, 7},
+                    "Title", "Agent", "http://host/path", "123");
+        
     }
 
@@ -144,18 +181,75 @@
     @Test
     public void testComplexMessage() throws Exception {
+        String clientId = "123";
+        
         String message =
             "{" +
             "  \"message\": {" +
             "    \"clientInfos\": {" +
-            "      \"clientId\":\"123\"," +
+            "      \"clientId\":\"" + clientId + "\"," +
             "      \"userAgent\":\"Agent\"," +
             "      \"title\":\"Title\"," +
             "      \"url\":\"http://host/path\"" +
             "    }," +
+            "    \"guiModel\": {" +
+            "      \"tagName\":\"html\"," +
+            "      \"index\":\"0\"," +
+            "      \"children\":" +
+            "      [ {" +
+            "          \"tagName\":\"head\"," +
+            "          \"index\":\"0\"," +
+            "        }," +
+            "        {" +
+            "          \"tagName\":\"body\"," +
+            "          \"htmlId\":\"gsr\"," +
+            "          \"children\":" +
+            "          [ {" +
+            "              \"tagName\":\"input_button\"," +
+            "              \"htmlId\":\"input1\"," +
+            "            }," +
+            "            {" +
+            "              \"tagName\":\"input_button\"," +
+            "              \"htmlId\":\"input2\"," +
+            "            }," +
+            "            {" +
+            "              \"tagName\":\"input_button\"," +
+            "              \"htmlId\":\"input3\"," +
+            "            }," +
+            "            {" +
+            "              \"tagName\":\"input_button\"," +
+            "              \"htmlId\":\"input4\"," +
+            "            }," +
+            "            {" +
+            "              \"tagName\":\"input_button\"," +
+            "              \"htmlId\":\"input5\"," +
+            "            }," +
+            "            {" +
+            "              \"tagName\":\"input_button\"," +
+            "              \"htmlId\":\"input6\"," +
+            "            }," +
+            "            {" +
+            "              \"tagName\":\"input_button\"," +
+            "              \"htmlId\":\"input7\"," +
+            "            }," +
+            "            {" +
+            "              \"tagName\":\"input_button\"," +
+            "              \"htmlId\":\"input8\"," +
+            "            }," +
+            "            {" +
+            "              \"tagName\":\"input_button\"," +
+            "              \"htmlId\":\"input9\"," +
+            "            }," +
+            "            {" +
+            "              \"tagName\":\"input_button\"," +
+            "              \"htmlId\":\"input10\"," +
+            "            }," +
+            "          ]" +
+            "        }" +
+            "      ]" +
+            "    }," +
             "    \"events\":" +
-            "    [" +
-            "      {" +
+            "    [ {" +
             "        \"time\":\"1\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)/input(id=input1)\"," +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)/input_button(htmlId=input1)\"," +
             "        \"eventType\":\"onclick\"," +
             "        \"coordinates\": [\"194\", \"7\"]" +
@@ -163,5 +257,5 @@
             "      {" +
             "        \"time\":\"2\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)/input(id=input2)\"," +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)/input_button(htmlId=input2)\"," +
             "        \"eventType\":\"ondblclick\"," +
             "        \"coordinates\": [\"194\", \"7\"]" +
@@ -169,10 +263,10 @@
             "      {" +
             "        \"time\":\"3\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)/input(id=input3)\"," +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)/input_button(htmlId=input3)\"," +
             "        \"eventType\":\"onfocus\"" +
             "      }," +
             "      {" +
             "        \"time\":\"4\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)/input(id=input4)\"," +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)/input_button(htmlId=input4)\"," +
             "        \"eventType\":\"onclick\"," +
             "        \"coordinates\": [\"125\", \"14\"]" +
@@ -180,20 +274,20 @@
             "      {" +
             "        \"time\":\"5\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)/input(id=input5)\"," +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)/input_button(htmlId=input5)\"," +
             "        \"eventType\":\"onfocus\"" +
             "      }," +
             "      {" +
             "        \"time\":\"6\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)/input(id=input6)\"," +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)/input_button(htmlId=input6)\"," +
             "        \"eventType\":\"onfocus\"" +
             "      }," +
             "      {" +
             "        \"time\":\"7\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)/input(id=input7)\"," +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)/input_button(htmlId=input7)\"," +
             "        \"eventType\":\"onfocus\"" +
             "      }," +
             "      {" +
             "        \"time\":\"8\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)/input(id=input8)\"," +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)/input_button(htmlId=input8)\"," +
             "        \"eventType\":\"onclick\"," +
             "        \"coordinates\": [\"255\", \"4\"]" +
@@ -201,5 +295,5 @@
             "      {" +
             "        \"time\":\"9\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)\"," +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)\"," +
             "        \"eventType\":\"onscroll\"," +
             "        \"scrollPosition\": [\"23\", \"567\"]" +
@@ -207,5 +301,5 @@
             "      {" +
             "        \"time\":\"10\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)/input(id=input10)\"," +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)/input_button(htmlId=input10)\"," +
             "        \"eventType\":\"onclick\"," +
             "        \"coordinates\": [\"516\", \"154\"]" +
@@ -214,5 +308,5 @@
             "  }" +
             "}";
-        
+ 
         sendMessageAndAssertResponse(message);
         
@@ -221,55 +315,85 @@
         }
         
+        // check the GUI structure
+        HtmlGUIElement parent = null;
+        HtmlGUIElement element = guiStructure;
+        
+        assertGuiElement(element, HtmlServer.class, parent, 1);
+        
+        parent = element;
+        element = parent.getChildren().get(0);
+        assertGuiElement(element, HtmlDocument.class, parent, 1);
+        
+        HtmlDocument document = (HtmlDocument) element;
+        
+        parent = element;
+        element = parent.getChildren().get(0);
+        assertGuiElement(element, HtmlPageElement.class, parent, 2);
+
+        parent = element;
+        element = parent.getChildren().get(0);
+        assertGuiElement(element, HtmlPageElement.class, parent, 0);
+        element = parent.getChildren().get(1);
+        assertGuiElement(element, HtmlPageElement.class, parent, 10);
+        
+        parent = element;
+        for (HtmlGUIElement child : parent.getChildren()) {
+            assertGuiElement(child, HtmlPageElement.class, parent, 0);
+        }
+
+        // check the events
         assertNotNull(events);
         assertEquals(10, events.length);
 
         for (int i = 0; i < events.length; i++) {
-            assertEquals("event " + i, new Long(i + 1), events[i].getTime());
+            String targetDOMPath;
+            HtmlGUIElement target;
+            Integer[] scrollPosition = null;
             
             if (i == 8) {
-                assertEquals("event " + i, "/html[0]/body(id=gsr)", events[i].getPath());
+                targetDOMPath = "/html[0]/body(htmlId=gsr)";
+                target = parent;
+                scrollPosition = new Integer[] { 23, 567 };
             }
             else {
-                assertEquals("event " + i, "/html[0]/body(id=gsr)/input(id=input" + (i + 1) + ")",
-                             events[i].getPath());
-            }
-            
+                targetDOMPath =
+                    "/html[0]/body(htmlId=gsr)/input_button(htmlId=input" + (i + 1) + ")";
+                target = parent.getChildren().get(i);
+            }
+            
+            String eventType;
             if ((i == 1)) {
-                assertEquals("event " + i, "ondblclick", events[i].getEventType());
+                eventType = "ondblclick";
             }
             else if ((i == 2) || ((4 <= i) && (i <= 6))) {
-                assertEquals("event " + i, "onfocus", events[i].getEventType());
+                eventType = "onfocus";
             }
             else if ((i == 8)) {
-                assertEquals("event " + i, "onscroll", events[i].getEventType());
+                eventType = "onscroll";
             }
             else {
-                assertEquals("event " + i, "onclick", events[i].getEventType());
+                eventType = "onclick";
             }
             
             assertNull("event " + i, events[i].getKey());
             
-            if ((i == 8)) {
-                assertNotNull("event " + i, events[i].getScrollPosition());
-                assertArrayEquals
-                    ("event " + i, new Integer[] { 23, 567 }, events[i].getScrollPosition());
-            }
-            else {
-                assertNull("event " + i, events[i].getScrollPosition());
-            }
-            
-            if ((i == 2) || ((4 <= i) && (i <= 6)) || (i == 8)) {
-                assertNull("event " + i, events[i].getCoordinates());
-            }
-            else {
-                assertNotNull("event " + i, events[i].getCoordinates());
-                assertEquals("event " + i, 2, events[i].getCoordinates().length);
-            }
-            
-            assertEquals("event " + i, "Title", events[i].getClientInfos().getTitle());
-            assertEquals("event " + i, "Agent", events[i].getClientInfos().getUserAgent());
-            assertEquals("event " + i, "http://host/path",
-                         events[i].getClientInfos().getUrl().toString());
-            assertEquals("event " + i, "123", events[i].getClientInfos().getClientId());
+            Integer[] coordinates = null;
+            if (i <= 1) {
+                coordinates = new Integer[] { 194, 7 };
+            }
+            else if (i == 3) {
+                coordinates = new Integer[] { 125, 14 };
+            }
+            else if (i == 7) {
+                coordinates = new Integer[] { 255, 4 };
+            }
+            else if (i == 9) {
+                coordinates = new Integer[] { 516, 154 };
+            }
+            
+            assertEvent(i, i + 1, targetDOMPath, target, document, eventType,
+                        null, scrollPosition, coordinates,
+                        "Title", "Agent", "http://host/path", "123");
+            
         }
     }
@@ -310,9 +434,23 @@
             "      \"url\":\"http://host/path\"" +
             "    }," +
+            "    \"guiModel\": {" +
+            "      \"tagName\":\"html\"," +
+            "      \"index\":\"0\"," +
+            "      \"children\":" +
+            "      [ {" +
+            "          \"tagName\":\"head\"," +
+            "          \"index\":\"0\"," +
+            "        }," +
+            "        {" +
+            "          \"tagName\":\"body\"," +
+            "          \"htmlId\":\"gsr\"," +
+            "        }" +
+            "      ]" +
+            "    }," +
             "    \"events\":" +
             "    [ {" +
-            "        \"time\":\"12345\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)\"," +
-            "        \"eventType\":\"onscroll\"" +
+            "        \"time\":\"9\"," +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)\"," +
+            "        \"eventType\":\"onscroll\"," +
             "      }" +
             "    ]" +
@@ -337,8 +475,22 @@
             "      \"url\":\"http://host/path\"" +
             "    }," +
+            "    \"guiModel\": {" +
+            "      \"tagName\":\"html\"," +
+            "      \"index\":\"0\"," +
+            "      \"children\":" +
+            "      [ {" +
+            "          \"tagName\":\"head\"," +
+            "          \"index\":\"0\"," +
+            "        }," +
+            "        {" +
+            "          \"tagName\":\"body\"," +
+            "          \"htmlId\":\"gsr\"," +
+            "        }" +
+            "      ]" +
+            "    }," +
             "    \"events\":" +
             "    [ {" +
             "        \"time\":\"12345\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)\"," +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)\"," +
             "        \"eventType\":\"onunload\"" +
             "      }" +
@@ -365,8 +517,22 @@
             "      \"url\":\"http://host/path\"" +
             "    }," +
+            "    \"guiModel\": {" +
+            "      \"tagName\":\"html\"," +
+            "      \"index\":\"0\"," +
+            "      \"children\":" +
+            "      [ {" +
+            "          \"tagName\":\"head\"," +
+            "          \"index\":\"0\"," +
+            "        }," +
+            "        {" +
+            "          \"tagName\":\"body\"," +
+            "          \"htmlId\":\"gsr\"," +
+            "        }" +
+            "      ]" +
+            "    }," +
             "    \"events\":" +
             "    [ {" +
             "        \"time\":\"blub\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)\"," +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)\"," +
             "        \"eventType\":\"onunload\"" +
             "      }" +
@@ -389,7 +555,13 @@
      */
     @Override
-    public void handleMessage(HtmlClientInfos clientInfos, HtmlEvent[] events) {
+    public void handleMessage(HtmlClientInfos clientInfos,
+                              HtmlGUIElement  guiStructure,
+                              HtmlEvent[]     events)
+    {
         if (clientInfos == null) {
             eventHandlingError = "client infos were null";
+        }
+        else if (guiStructure == null) {
+            eventHandlingError = "gui structure was null";
         }
         else if (events == null) {
@@ -404,4 +576,5 @@
             
             this.events = events;
+            this.guiStructure = guiStructure;
         }
     }
@@ -435,3 +608,68 @@
     }
 
+    /**
+     *
+     */
+    private void assertGuiElement(HtmlGUIElement                  element,
+                                  Class<? extends HtmlGUIElement> type,
+                                  HtmlGUIElement                  parent,
+                                  int                             noOfChildren)
+    {
+        assertTrue(type.isInstance(element));
+        
+        if (parent != null) {
+            assertEquals(parent.getId(), element.getParentId());
+        }
+        else {
+            assertNull(element.getParentId());
+        }
+        
+        assertNotNull(element.getId());
+        
+        if (noOfChildren > 0) {
+            assertNotNull(element.getChildren());
+            assertEquals(noOfChildren, element.getChildren().size());
+        }
+        else {
+            assertNull(element.getChildren());
+        }
+    }
+
+    /**
+     *
+     */
+    private void assertEvent(int            index,
+                             long           timestamp,
+                             String         targetDOMPath,
+                             HtmlGUIElement target,
+                             HtmlDocument   document,
+                             String         eventType,
+                             Integer        key,
+                             Integer[]      scrollPosition,
+                             Integer[]      coordinates,
+                             String         clientInfoTitle,
+                             String         clientInfoAgent,
+                             String         clientInfoURL,
+                             String         clientId)
+    {
+        assertEquals("event " + index, new Long(timestamp), events[index].getTime());
+        assertEquals("event " + index, targetDOMPath, events[index].getTargetDOMPath());
+        assertEquals("event " + index, target, events[index].getTarget());
+        assertEquals("event " + index, document, events[index].getTargetDocument());
+        assertEquals("event " + index, eventType, events[index].getEventType());
+        
+        assertEquals("event " + index, key, events[index].getKey());
+        assertArrayEquals("event " + index, scrollPosition, events[index].getScrollPosition());
+        assertArrayEquals("event " + index, coordinates, events[index].getCoordinates());
+        
+        assertEquals
+            ("event " + index, clientInfoTitle, events[index].getClientInfos().getTitle());
+        assertEquals
+            ("event " + index, clientInfoAgent, events[index].getClientInfos().getUserAgent());
+        assertEquals
+            ("event " + index, clientInfoURL, events[index].getClientInfos().getUrl().toString());
+        assertEquals
+            ("event " + index, clientId, events[index].getClientInfos().getClientId());
+    }
+
 }
Index: trunk/autoquest-htmlmonitor-test/src/test/java/de/ugoe/cs/autoquest/htmlmonitor/HtmlMonitorTest.java
===================================================================
--- trunk/autoquest-htmlmonitor-test/src/test/java/de/ugoe/cs/autoquest/htmlmonitor/HtmlMonitorTest.java	(revision 1000)
+++ trunk/autoquest-htmlmonitor-test/src/test/java/de/ugoe/cs/autoquest/htmlmonitor/HtmlMonitorTest.java	(revision 1069)
@@ -17,9 +17,7 @@
 import static org.junit.Assert.*;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
 import java.util.List;
 
@@ -34,4 +32,17 @@
 import org.junit.Test;
 
+import de.ugoe.cs.autoquest.eventcore.Event;
+import de.ugoe.cs.autoquest.eventcore.IEventType;
+import de.ugoe.cs.autoquest.eventcore.gui.KeyboardFocusChange;
+import de.ugoe.cs.autoquest.eventcore.gui.MouseButtonInteraction;
+import de.ugoe.cs.autoquest.eventcore.gui.MouseClick;
+import de.ugoe.cs.autoquest.eventcore.gui.MouseDoubleClick;
+import de.ugoe.cs.autoquest.eventcore.gui.Scroll;
+import de.ugoe.cs.autoquest.eventcore.guimodel.GUIModel;
+import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement;
+import de.ugoe.cs.autoquest.plugin.html.HTMLLogParser;
+import de.ugoe.cs.autoquest.plugin.html.guimodel.HTMLDocument;
+import de.ugoe.cs.autoquest.plugin.html.guimodel.HTMLPageElement;
+import de.ugoe.cs.autoquest.plugin.html.guimodel.HTMLServer;
 import de.ugoe.cs.util.console.TextConsole;
 
@@ -108,9 +119,24 @@
             "      \"url\":\"http://host/path\"" +
             "    }," +
+            "    \"guiModel\": {" +
+            "      \"tagName\":\"html\"," +
+            "      \"index\":\"0\"," +
+            "      \"children\":" +
+            "      [ {" +
+            "          \"tagName\":\"head\"," +
+            "          \"index\":\"0\"," +
+            "        }," +
+            "        {" +
+            "          \"tagName\":\"body\"," +
+            "          \"htmlId\":\"gsr\"," +
+            "        }" +
+            "      ]" +
+            "    }," +
             "    \"events\":" +
             "    [ {" +
             "        \"time\":\"12345\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)\"," +
-            "        \"eventType\":\"onunload\"" +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)\"," +
+            "        \"eventType\":\"onclick\"" +
+            "        \"coordinates\": [\"194\", \"7\"]" +
             "      }" +
             "    ]" +
@@ -120,14 +146,83 @@
         sendMessageAndAssertResponse(message);
         
+        htmlMonitor.stop();
+        htmlMonitor = null;
+
         File logFile = new File(LOG_FILE_DIR + File.separator + clientId + File.separator +
-                                "htmlmonitor_" + clientId + ".log");
+                                "htmlmonitor_" + clientId + "_000.log");
         
         assertTrue(logFile.exists());
         
-        String[] logEntries = readLogEntries(logFile);
-        assertEquals(1, logEntries.length);
-        
-        assertLogMessage(logEntries[0], clientId, "12345", "Title", "http://host/path", "Agent",
-                         "onunload", "/html[0]/body(id=gsr)");
+        HTMLLogParser parser = new HTMLLogParser();
+        
+        parser.parseFile(logFile);
+        
+        // check the GUI model
+        GUIModel guiModel = parser.getGuiModel();
+        assertNotNull(guiModel);
+        
+        List<IGUIElement> nodes = guiModel.getRootElements();
+        assertNotNull(nodes);
+        assertEquals(1, nodes.size());
+        
+        // get server node
+        IGUIElement node = nodes.get(0);
+        assertNotNull(node);
+        assertTrue(node instanceof HTMLServer);
+        assertEquals("HTML", node.getPlatform());
+        assertFalse(node.isUsed());
+        
+        nodes = guiModel.getChildren(node);
+        assertNotNull(nodes);
+        assertEquals(1, nodes.size());
+        
+        // get document node
+        node = nodes.get(0);
+        assertNotNull(node);
+        assertTrue(node instanceof HTMLDocument);
+        assertEquals("HTML", node.getPlatform());
+        assertFalse(node.isUsed());
+        
+        nodes = guiModel.getChildren(node);
+        assertNotNull(nodes);
+        assertEquals(1, nodes.size());
+        
+        // get html node
+        node = nodes.get(0);
+        assertNotNull(node);
+        assertTrue(node instanceof HTMLPageElement);
+        assertEquals("HTML", node.getPlatform());
+        assertFalse(node.isUsed());
+        
+        nodes = guiModel.getChildren(node);
+        assertNotNull(nodes);
+        assertEquals(1, nodes.size()); // only one child as the head tag should have been ignored
+        
+        // get body node
+        node = nodes.get(0);
+        assertNotNull(node);
+        assertTrue(node instanceof HTMLPageElement);
+        assertEquals("HTML", node.getPlatform());
+        assertTrue(node.isUsed());
+
+        nodes = guiModel.getChildren(node);
+        assertNotNull(nodes);
+        assertEquals(0, nodes.size());
+        
+        // check the sequences
+        Collection<List<Event>> sequences = parser.getSequences();
+        
+        assertNotNull(sequences);
+        
+        Iterator<List<Event>> iterator = sequences.iterator();
+        assertTrue(iterator.hasNext());
+        
+        List<Event> sequence = iterator.next();
+        assertFalse(iterator.hasNext());
+        
+        assertNotNull(sequence);
+        assertEquals(1, sequence.size());
+        
+        assertEvent(sequence.get(0), 12345, MouseClick.class, node, 194, 7);
     }
 
@@ -148,9 +243,64 @@
             "      \"url\":\"http://host/path\"" +
             "    }," +
+            "    \"guiModel\": {" +
+            "      \"tagName\":\"html\"," +
+            "      \"index\":\"0\"," +
+            "      \"children\":" +
+            "      [ {" +
+            "          \"tagName\":\"head\"," +
+            "          \"index\":\"0\"," +
+            "        }," +
+            "        {" +
+            "          \"tagName\":\"body\"," +
+            "          \"htmlId\":\"gsr\"," +
+            "          \"children\":" +
+            "          [ {" +
+            "              \"tagName\":\"input_button\"," +
+            "              \"htmlId\":\"input1\"," +
+            "            }," +
+            "            {" +
+            "              \"tagName\":\"input_button\"," +
+            "              \"htmlId\":\"input2\"," +
+            "            }," +
+            "            {" +
+            "              \"tagName\":\"input_button\"," +
+            "              \"htmlId\":\"input3\"," +
+            "            }," +
+            "            {" +
+            "              \"tagName\":\"input_button\"," +
+            "              \"htmlId\":\"input4\"," +
+            "            }," +
+            "            {" +
+            "              \"tagName\":\"input_button\"," +
+            "              \"htmlId\":\"input5\"," +
+            "            }," +
+            "            {" +
+            "              \"tagName\":\"input_button\"," +
+            "              \"htmlId\":\"input6\"," +
+            "            }," +
+            "            {" +
+            "              \"tagName\":\"input_button\"," +
+            "              \"htmlId\":\"input7\"," +
+            "            }," +
+            "            {" +
+            "              \"tagName\":\"input_button\"," +
+            "              \"htmlId\":\"input8\"," +
+            "            }," +
+            "            {" +
+            "              \"tagName\":\"input_button\"," +
+            "              \"htmlId\":\"input9\"," +
+            "            }," +
+            "            {" +
+            "              \"tagName\":\"input_button\"," +
+            "              \"htmlId\":\"input10\"," +
+            "            }," +
+            "          ]" +
+            "        }" +
+            "      ]" +
+            "    }," +
             "    \"events\":" +
-            "    [" +
-            "      {" +
+            "    [ {" +
             "        \"time\":\"1\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)/input(id=input1)\"," +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)/input_button(htmlId=input1)\"," +
             "        \"eventType\":\"onclick\"," +
             "        \"coordinates\": [\"194\", \"7\"]" +
@@ -158,5 +308,5 @@
             "      {" +
             "        \"time\":\"2\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)/input(id=input2)\"," +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)/input_button(htmlId=input2)\"," +
             "        \"eventType\":\"ondblclick\"," +
             "        \"coordinates\": [\"194\", \"7\"]" +
@@ -164,10 +314,10 @@
             "      {" +
             "        \"time\":\"3\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)/input(id=input3)\"," +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)/input_button(htmlId=input3)\"," +
             "        \"eventType\":\"onfocus\"" +
             "      }," +
             "      {" +
             "        \"time\":\"4\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)/input(id=input4)\"," +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)/input_button(htmlId=input4)\"," +
             "        \"eventType\":\"onclick\"," +
             "        \"coordinates\": [\"125\", \"14\"]" +
@@ -175,20 +325,20 @@
             "      {" +
             "        \"time\":\"5\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)/input(id=input5)\"," +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)/input_button(htmlId=input5)\"," +
             "        \"eventType\":\"onfocus\"" +
             "      }," +
             "      {" +
             "        \"time\":\"6\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)/input(id=input6)\"," +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)/input_button(htmlId=input6)\"," +
             "        \"eventType\":\"onfocus\"" +
             "      }," +
             "      {" +
             "        \"time\":\"7\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)/input(id=input7)\"," +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)/input_button(htmlId=input7)\"," +
             "        \"eventType\":\"onfocus\"" +
             "      }," +
             "      {" +
             "        \"time\":\"8\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)/input(id=input8)\"," +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)/input_button(htmlId=input8)\"," +
             "        \"eventType\":\"onclick\"," +
             "        \"coordinates\": [\"255\", \"4\"]" +
@@ -196,5 +346,5 @@
             "      {" +
             "        \"time\":\"9\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)\"," +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)\"," +
             "        \"eventType\":\"onscroll\"," +
             "        \"scrollPosition\": [\"23\", \"567\"]" +
@@ -202,5 +352,5 @@
             "      {" +
             "        \"time\":\"10\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)/input(id=input10)\"," +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)/input_button(htmlId=input10)\"," +
             "        \"eventType\":\"onclick\"," +
             "        \"coordinates\": [\"516\", \"154\"]" +
@@ -212,32 +362,111 @@
         sendMessageAndAssertResponse(message);
         
+        htmlMonitor.stop();
+        htmlMonitor = null;
+
         File logFile = new File(LOG_FILE_DIR + File.separator + clientId + File.separator +
-                                "htmlmonitor_" + clientId + ".log");
+                                "htmlmonitor_" + clientId + "_000.log");
         
         assertTrue(logFile.exists());
         
-        String[] logEntries = readLogEntries(logFile);
-        assertEquals(10, logEntries.length);
-        
-        assertLogMessage(logEntries[0], clientId, "1", "Title", "http://host/path", "Agent",
-                         "onclick", "/html[0]/body(id=gsr)/input(id=input1)", "194,7");
-        assertLogMessage(logEntries[1], clientId, "2", "Title", "http://host/path", "Agent",
-                         "ondblclick", "/html[0]/body(id=gsr)/input(id=input2)", "194,7");
-        assertLogMessage(logEntries[2], clientId, "3", "Title", "http://host/path", "Agent",
-                         "onfocus", "/html[0]/body(id=gsr)/input(id=input3)");
-        assertLogMessage(logEntries[3], clientId, "4", "Title", "http://host/path", "Agent",
-                         "onclick", "/html[0]/body(id=gsr)/input(id=input4)", "125,14");
-        assertLogMessage(logEntries[4], clientId, "5", "Title", "http://host/path", "Agent",
-                         "onfocus", "/html[0]/body(id=gsr)/input(id=input5)");
-        assertLogMessage(logEntries[5], clientId, "6", "Title", "http://host/path", "Agent",
-                         "onfocus", "/html[0]/body(id=gsr)/input(id=input6)");
-        assertLogMessage(logEntries[6], clientId, "7", "Title", "http://host/path", "Agent",
-                         "onfocus", "/html[0]/body(id=gsr)/input(id=input7)");
-        assertLogMessage(logEntries[7], clientId, "8", "Title", "http://host/path", "Agent",
-                         "onclick", "/html[0]/body(id=gsr)/input(id=input8)", "255,4");
-        assertLogMessage(logEntries[8], clientId, "9", "Title", "http://host/path", "Agent",
-                         "onscroll", "/html[0]/body(id=gsr)", "23,567");
-        assertLogMessage(logEntries[9], clientId, "10", "Title", "http://host/path", "Agent",
-                         "onclick", "/html[0]/body(id=gsr)/input(id=input10)", "516,154");
+        HTMLLogParser parser = new HTMLLogParser();
+        
+        parser.parseFile(logFile);
+        
+        // check the GUI model
+        GUIModel guiModel = parser.getGuiModel();
+        assertNotNull(guiModel);
+        
+        List<IGUIElement> nodes = guiModel.getRootElements();
+        assertNotNull(nodes);
+        assertEquals(1, nodes.size());
+        
+        // get server node
+        IGUIElement node = nodes.get(0);
+        assertNotNull(node);
+        assertTrue(node instanceof HTMLServer);
+        assertEquals("HTML", node.getPlatform());
+        assertFalse(node.isUsed());
+        
+        nodes = guiModel.getChildren(node);
+        assertNotNull(nodes);
+        assertEquals(1, nodes.size());
+        
+        // get document node
+        node = nodes.get(0);
+        assertNotNull(node);
+        assertTrue(node instanceof HTMLDocument);
+        assertEquals("HTML", node.getPlatform());
+        assertFalse(node.isUsed());
+        
+        nodes = guiModel.getChildren(node);
+        assertNotNull(nodes);
+        assertEquals(1, nodes.size());
+        
+        // get html node
+        node = nodes.get(0);
+        assertNotNull(node);
+        assertTrue(node instanceof HTMLPageElement);
+        assertEquals("HTML", node.getPlatform());
+        assertFalse(node.isUsed());
+        
+        nodes = guiModel.getChildren(node);
+        assertNotNull(nodes);
+        assertEquals(1, nodes.size()); // only one child as the head tag should have been ignored
+        
+        // get body node
+        IGUIElement body = nodes.get(0);
+        assertNotNull(body);
+        assertTrue(body instanceof HTMLPageElement);
+        assertEquals("HTML", body.getPlatform());
+        assertTrue(body.isUsed());
+
+        nodes = guiModel.getChildren(body);
+        assertNotNull(nodes);
+        assertEquals(10, nodes.size());
+        
+        // get input nodes
+        for (int i = 0; i < nodes.size(); i++) {
+            node = nodes.get(i);
+            assertNotNull(node);
+            assertTrue(node instanceof HTMLPageElement);
+            assertEquals("HTML", node.getPlatform());
+            
+            if (i != 8) {
+                assertTrue(node.isUsed());
+            }
+            else {
+                assertFalse(node.isUsed());
+            }
+
+            assertNotNull(guiModel.getChildren(node));
+            assertEquals(0, guiModel.getChildren(node).size());
+        }
+        
+        // check the sequences
+        Collection<List<Event>> sequences = parser.getSequences();
+        
+        assertNotNull(sequences);
+        
+        Iterator<List<Event>> iterator = sequences.iterator();
+        assertTrue(iterator.hasNext());
+        
+        List<Event> sequence = iterator.next();
+        assertFalse(iterator.hasNext());
+        
+        assertNotNull(sequence);
+        assertEquals(10, sequence.size());
+        
+        assertEvent(sequence.get(0), 1, MouseClick.class, nodes.get(0), 194, 7);
+        assertEvent(sequence.get(1), 2, MouseDoubleClick.class, nodes.get(1), 194, 7);
+        assertEvent(sequence.get(2), 3, KeyboardFocusChange.class, nodes.get(2), 0, 0);
+        assertEvent(sequence.get(3), 4, MouseClick.class, nodes.get(3), 125, 14);
+        assertEvent(sequence.get(4), 5, KeyboardFocusChange.class, nodes.get(4), 0, 0);
+        assertEvent(sequence.get(5), 6, KeyboardFocusChange.class, nodes.get(5), 0, 0);
+        assertEvent(sequence.get(6), 7, KeyboardFocusChange.class, nodes.get(6), 0, 0);
+        assertEvent(sequence.get(7), 8, MouseClick.class, nodes.get(7), 255, 4);
+        assertEvent(sequence.get(8), 9, Scroll.class, body, 0, 0);
+        assertEvent(sequence.get(9), 10, MouseClick.class, nodes.get(9), 516, 154);
+
     }
 
@@ -258,9 +487,24 @@
             "      \"url\":\"http://host/path\"" +
             "    }," +
+            "    \"guiModel\": {" +
+            "      \"tagName\":\"html\"," +
+            "      \"index\":\"0\"," +
+            "      \"children\":" +
+            "      [ {" +
+            "          \"tagName\":\"head\"," +
+            "          \"index\":\"0\"," +
+            "        }," +
+            "        {" +
+            "          \"tagName\":\"body\"," +
+            "          \"htmlId\":\"gsr\"," +
+            "        }" +
+            "      ]" +
+            "    }," +
             "    \"events\":" +
             "    [ {" +
             "        \"time\":\"12345\"," +
-            "        \"path\":\"/html[0]/body(id=gsr)\"," +
-            "        \"eventType\":\"onunload\"" +
+            "        \"path\":\"/html[0]/body(htmlId=gsr)\"," +
+            "        \"eventType\":\"onclick\"" +
+            "        \"coordinates\": [\"194\", \"7\"]" +
             "      }" +
             "    ]" +
@@ -279,6 +523,11 @@
         }
         
+        htmlMonitor.stop();
+        htmlMonitor = null;
+        
+        HTMLLogParser parser = new HTMLLogParser();
+        
         // assert 9 already rotated log files
-        for (int i = 0; i < (numberOfSessions - 1); i++) {
+        for (int i = 0; i < numberOfSessions; i++) {
             File logFile = new File(LOG_FILE_DIR + File.separator + clientId + File.separator +
                                     "htmlmonitor_" + clientId + "_00" + i + ".log");
@@ -286,22 +535,75 @@
             assertTrue(logFile.exists());
        
-            String[] logEntries = readLogEntries(logFile);
-            assertEquals(1, logEntries.length);
+            parser.parseFile(logFile);
+        }
+
+        // check the GUI model
+        GUIModel guiModel = parser.getGuiModel();
+        assertNotNull(guiModel);
+        
+        List<IGUIElement> nodes = guiModel.getRootElements();
+        assertNotNull(nodes);
+        assertEquals(1, nodes.size());
+        
+        // get server node
+        IGUIElement node = nodes.get(0);
+        assertNotNull(node);
+        assertTrue(node instanceof HTMLServer);
+        assertEquals("HTML", node.getPlatform());
+        assertFalse(node.isUsed());
+        
+        nodes = guiModel.getChildren(node);
+        assertNotNull(nodes);
+        assertEquals(1, nodes.size());
+        
+        // get document node
+        node = nodes.get(0);
+        assertNotNull(node);
+        assertTrue(node instanceof HTMLDocument);
+        assertEquals("HTML", node.getPlatform());
+        assertFalse(node.isUsed());
+        
+        nodes = guiModel.getChildren(node);
+        assertNotNull(nodes);
+        assertEquals(1, nodes.size());
+        
+        // get html node
+        node = nodes.get(0);
+        assertNotNull(node);
+        assertTrue(node instanceof HTMLPageElement);
+        assertEquals("HTML", node.getPlatform());
+        assertFalse(node.isUsed());
+        
+        nodes = guiModel.getChildren(node);
+        assertNotNull(nodes);
+        assertEquals(1, nodes.size()); // only one child as the head tag should have been ignored
+        
+        // get body node
+        node = nodes.get(0);
+        assertNotNull(node);
+        assertTrue(node instanceof HTMLPageElement);
+        assertEquals("HTML", node.getPlatform());
+        assertTrue(node.isUsed());
+
+        nodes = guiModel.getChildren(node);
+        assertNotNull(nodes);
+        assertEquals(0, nodes.size());
+        
+        // check the sequences
+        Collection<List<Event>> sequences = parser.getSequences();
+        
+        assertNotNull(sequences);
+        assertEquals(numberOfSessions, sequences.size());
+        
+        Iterator<List<Event>> iterator = sequences.iterator();
+        
+        while (iterator.hasNext()) {
+            List<Event> sequence = iterator.next();
+        
+            assertNotNull(sequence);
+            assertEquals(1, sequence.size());
        
-            assertLogMessage(logEntries[0], clientId, "12345", "Title", "http://host/path", "Agent",
-                             "onunload", "/html[0]/body(id=gsr)");
-        }
-
-        // and now the last but current one
-        File logFile = new File(LOG_FILE_DIR + File.separator + clientId + File.separator +
-                                "htmlmonitor_" + clientId + ".log");
-   
-        assertTrue(logFile.exists());
-   
-        String[] logEntries = readLogEntries(logFile);
-        assertEquals(1, logEntries.length);
-   
-        assertLogMessage(logEntries[0], clientId, "12345", "Title", "http://host/path", "Agent",
-                         "onunload", "/html[0]/body(id=gsr)");
+            assertEvent(sequence.get(0), 12345, MouseClick.class, node, 194, 7);
+        }
     }
 
@@ -335,52 +637,21 @@
 
     /**
-     * <p>
-     * TODO: comment
-     * </p>
-     *
-     * @param logFile
-     * @return
-     */
-    private String[] readLogEntries(File logFile) throws Exception {
-        List<String> logEntries = new ArrayList<String>();
-        BufferedReader reader = null;
-        
-        try {
-            reader = new BufferedReader
-                (new InputStreamReader(new FileInputStream(logFile)));
-        
-            String line = null;
-            while ((line = reader.readLine()) != null) {
-                logEntries.add(line);
-            }
-        }
-        finally {
-            if (reader != null) {
-                reader.close();
-            }
-        }
-        
-        return logEntries.toArray(new String[logEntries.size()]);
-    }
-
-    /**
-     *
-     */
-    private void assertLogMessage(String    logMessage,
-                                  String... assertedMessageContent)
+     *
+     */
+    private void assertEvent(Event                       event,
+                             int                         timestamp,
+                             Class<? extends IEventType> eventType,
+                             IGUIElement                 eventTarget,
+                             int                         xCoordinate,
+                             int                         yCoordinate)
     {
-        StringBuffer assertedMessage = new StringBuffer();
-        
-        for (int i = 0; i < assertedMessageContent.length; i++) {
-            if (i > 0) {
-                assertedMessage.append(' ');
-            }
-            
-            assertedMessage.append('"');
-            assertedMessage.append(assertedMessageContent[i]);
-            assertedMessage.append('"');
-        }
-        
-        assertEquals(assertedMessage.toString(), logMessage);
+        assertEquals(timestamp, event.getTimestamp());
+        assertTrue(eventType.isInstance(event.getType()));
+        assertEquals(eventTarget, event.getTarget());
+        
+        if (event.getType() instanceof MouseButtonInteraction) {
+            assertEquals(xCoordinate, ((MouseButtonInteraction) event.getType()).getX());
+            assertEquals(yCoordinate, ((MouseButtonInteraction) event.getType()).getY());
+        }
     }
 
Index: trunk/autoquest-htmlmonitor-test/src/test/resources/test.html
===================================================================
--- trunk/autoquest-htmlmonitor-test/src/test/resources/test.html	(revision 1000)
+++ trunk/autoquest-htmlmonitor-test/src/test/resources/test.html	(revision 1069)
@@ -5,4 +5,6 @@
 <script type="text/javascript"
 	src="http://localhost:8090/script/autoquest-htmlmonitor.js"></script>
+	
+	<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
 
 <style type="text/css">
@@ -16,5 +18,5 @@
 
 </style>
-
+<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
 </head>
 
@@ -30,5 +32,5 @@
       <tr>
         <td class="label">input type text</td>
-        <td><input type="text"></input></td>
+        <td><input type="text" /></td>
       </tr>
       <tr>
@@ -38,5 +40,5 @@
       <tr>
         <td class="label"></td>
-        <td><input type="button" value="Daten abschicken" onclick="sendRequest();"></input></td>
+        <td><input type="button" value="Daten abschicken" onclick="sendRequest();" /></td>
       </tr>
     </table>
