Merge pull request #4 from felixge/root

Implement Root method
diff --git a/etree.go b/etree.go
index 1dfdc3d..48ebd91 100644
--- a/etree.go
+++ b/etree.go
@@ -93,6 +93,17 @@
 	return &Document{*(doc.dup(nil).(*Element))}
 }
 
+// Root returns the root element of the document, or nil if there is no root
+// element.
+func (d *Document) Root() *Element {
+	for _, t := range d.Child {
+		if c, ok := t.(*Element); ok {
+			return c
+		}
+	}
+	return nil
+}
+
 // ReadFrom reads XML from the reader r into the document d.
 // It returns the number of bytes read and any error encountered.
 func (d *Document) ReadFrom(r io.Reader) (n int64, err error) {
diff --git a/etree_test.go b/etree_test.go
index 9f324af..fc9c914 100644
--- a/etree_test.go
+++ b/etree_test.go
@@ -51,6 +51,9 @@
 	}
 
 	// Test the structure of the XML
+	if doc.Root() != store {
+		t.Fail()
+	}
 	if len(store.ChildElements()) != 1 || len(store.Child) != 7 {
 		t.Fail()
 	}