Index: src/xmltables.sql
===================================================================
--- src/xmltables.sql	(revision 19)
+++ src/xmltables.sql	(revision 20)
@@ -13,35 +13,33 @@
 /*
  * Drop all of the objects in proper order
  */
-DROP SEQUENCE xml_attributes_id_seq;
-DROP TRIGGER xml_attributes_before_insert;
-DROP SEQUENCE xml_elements_id_seq;
-DROP TRIGGER xml_elements_before_insert;
+DROP SEQUENCE xml_nodes_id_seq;
+DROP TRIGGER xml_nodes_before_insert;
 DROP TABLE xml_documents;
-DROP TABLE xml_attributes;
-DROP TABLE xml_elements;
+DROP TABLE xml_nodes;
 
 /* 
- * Elements -- table to store XML Elements
+ * Nodes -- table to store XML Nodes (both elements and attributes)
  */
-CREATE TABLE xml_elements (
+CREATE TABLE xml_nodes (
 	nodeid		NUMBER(20),
 	parentnodeid	NUMBER(20),
+	nodetype	VARCHAR2(2000),
 	nodename	VARCHAR2(2000),
 	nodedata	VARCHAR2(2000),
 	date_created	DATE,
 	date_updated	DATE,
-   CONSTRAINT xml_elements_pk PRIMARY KEY (nodeid),
-   CONSTRAINT xml_elements_parent_fk 
-		FOREIGN KEY (parentnodeid) REFERENCES xml_elements
+   CONSTRAINT xml_nodes_pk PRIMARY KEY (nodeid),
+   CONSTRAINT xml_nodes_parent_fk 
+		FOREIGN KEY (parentnodeid) REFERENCES xml_nodes
 );
 
-CREATE SEQUENCE xml_elements_id_seq;
+CREATE SEQUENCE xml_nodes_id_seq;
 
-CREATE TRIGGER xml_elements_before_insert
-BEFORE INSERT ON xml_elements FOR EACH ROW
+CREATE TRIGGER xml_nodes_before_insert
+BEFORE INSERT ON xml_nodes FOR EACH ROW
 BEGIN
-  SELECT xml_elements_id_seq.nextval
+  SELECT xml_nodes_id_seq.nextval
     INTO :new.nodeid
     FROM dual;
 END;
@@ -59,34 +57,6 @@
 	date_updated	DATE,
    CONSTRAINT xml_documents_pk PRIMARY KEY (docid),
    CONSTRAINT xml_documents_root_fk 
-		FOREIGN KEY (rootnodeid) REFERENCES xml_elements
+		FOREIGN KEY (rootnodeid) REFERENCES xml_nodes
 );
 
-/* 
- * Attributes -- table to store XML Attributes
- */
-CREATE TABLE xml_attributes (
-	attributeid	NUMBER(20),
-	nodeid		NUMBER(20),
-	attributenumber	NUMBER(20),
-	attributename	VARCHAR2(256),
-	attributevalue	VARCHAR2(2000),
-	date_created	DATE,
-	date_updated	DATE,
-   CONSTRAINT xml_attributes_pk PRIMARY KEY (attributeid),
-   CONSTRAINT xml_attributes_parent_node FOREIGN KEY (nodeid) 
-		REFERENCES xml_elements,
-   CONSTRAINT xml_attributes_uniq_attribute UNIQUE (nodeid,attributename) 
-);
-
-CREATE SEQUENCE xml_attributes_id_seq;
-
-CREATE TRIGGER xml_attributes_before_insert
-BEFORE INSERT ON xml_attributes FOR EACH ROW
-BEGIN
-  SELECT xml_attributes_id_seq.nextval
-    INTO :new.attributeid
-    FROM dual;
-END;
-/
-
Index: src/edu/ucsb/nceas/metacat/DBSAXNode.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DBSAXNode.java	(revision 19)
+++ src/edu/ucsb/nceas/metacat/DBSAXNode.java	(revision 20)
@@ -42,18 +42,19 @@
           PreparedStatement pstmt;
           if (parent_id != 0) {
             pstmt = conn.prepareStatement(
-                "INSERT INTO xml_elements(nodeid, nodename, parentnodeid) " +
-                "VALUES (null, ?, ?)");
+                "INSERT INTO xml_nodes (nodeid, nodetype, " +
+                "nodename, parentnodeid) VALUES (null, ?, ?, ?)");
           } else {
             pstmt = conn.prepareStatement(
-                "INSERT INTO xml_elements(nodeid, nodename) " +
-                "VALUES (null, ?)");
+                "INSERT INTO xml_nodes (nodeid, nodetype, nodename) " +
+                "VALUES (null, ?, ?)");
           }
 
           // Bind the values to the query
-          pstmt.setString(1, getTagName());// The second ? is for NODENAME
+          pstmt.setString(1, "ELEMENT");
+          pstmt.setString(2, getTagName());
           if (parent_id != 0) {
-            pstmt.setLong(2, parent_id);
+            pstmt.setLong(3, parent_id);
           }
           // Do the insertion
           pstmt.execute();
@@ -72,7 +73,7 @@
         Statement stmt;
         try {
           stmt = conn.createStatement();
-          stmt.execute("SELECT xml_elements_id_seq.currval FROM dual");
+          stmt.execute("SELECT xml_nodes_id_seq.currval FROM dual");
           try {
             ResultSet rs = stmt.getResultSet();
             try {
@@ -140,14 +141,14 @@
         // And enter the attribute in the database
         try {
           PreparedStatement pstmt = conn.prepareStatement(
-              "INSERT INTO xml_attributes(attributeid, nodeid, " +
-              "attributename, attributevalue) " +
-              "VALUES (null, ?, ?, ?)");
+              "INSERT INTO xml_nodes (nodeid, nodetype, " +
+              "nodename, nodedata, parentnodeid) VALUES (null, ?, ?, ?, ?)");
 
           // Bind the values to the query
-          pstmt.setLong(1, getElementID());
+          pstmt.setString(1, "ATTRIBUTE");
           pstmt.setString(2, attName);
           pstmt.setString(3, attValue);
+          pstmt.setLong(4, getElementID());
  
           // Do the insertion
           pstmt.execute();
@@ -185,7 +186,7 @@
     public void writeContentToDB() {
         try {
           PreparedStatement pstmt = conn.prepareStatement(
-                "UPDATE xml_elements SET nodedata = ? WHERE nodeid = ?");
+                "UPDATE xml_nodes SET nodedata = ? WHERE nodeid = ?");
 
           // Bind the values to the query
           pstmt.setString(1, getContent());// The first ? is for NODEDATA
Index: src/edu/ucsb/nceas/metacat/DBSAXElement.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DBSAXElement.java	(revision 19)
+++ src/edu/ucsb/nceas/metacat/DBSAXElement.java	(revision 20)
@@ -42,18 +42,19 @@
           PreparedStatement pstmt;
           if (parent_id != 0) {
             pstmt = conn.prepareStatement(
-                "INSERT INTO xml_elements(nodeid, nodename, parentnodeid) " +
-                "VALUES (null, ?, ?)");
+                "INSERT INTO xml_nodes (nodeid, nodetype, " +
+                "nodename, parentnodeid) VALUES (null, ?, ?, ?)");
           } else {
             pstmt = conn.prepareStatement(
-                "INSERT INTO xml_elements(nodeid, nodename) " +
-                "VALUES (null, ?)");
+                "INSERT INTO xml_nodes (nodeid, nodetype, nodename) " +
+                "VALUES (null, ?, ?)");
           }
 
           // Bind the values to the query
-          pstmt.setString(1, getTagName());// The second ? is for NODENAME
+          pstmt.setString(1, "ELEMENT");
+          pstmt.setString(2, getTagName());
           if (parent_id != 0) {
-            pstmt.setLong(2, parent_id);
+            pstmt.setLong(3, parent_id);
           }
           // Do the insertion
           pstmt.execute();
@@ -72,7 +73,7 @@
         Statement stmt;
         try {
           stmt = conn.createStatement();
-          stmt.execute("SELECT xml_elements_id_seq.currval FROM dual");
+          stmt.execute("SELECT xml_nodes_id_seq.currval FROM dual");
           try {
             ResultSet rs = stmt.getResultSet();
             try {
@@ -140,14 +141,14 @@
         // And enter the attribute in the database
         try {
           PreparedStatement pstmt = conn.prepareStatement(
-              "INSERT INTO xml_attributes(attributeid, nodeid, " +
-              "attributename, attributevalue) " +
-              "VALUES (null, ?, ?, ?)");
+              "INSERT INTO xml_nodes (nodeid, nodetype, " +
+              "nodename, nodedata, parentnodeid) VALUES (null, ?, ?, ?, ?)");
 
           // Bind the values to the query
-          pstmt.setLong(1, getElementID());
+          pstmt.setString(1, "ATTRIBUTE");
           pstmt.setString(2, attName);
           pstmt.setString(3, attValue);
+          pstmt.setLong(4, getElementID());
  
           // Do the insertion
           pstmt.execute();
@@ -185,7 +186,7 @@
     public void writeContentToDB() {
         try {
           PreparedStatement pstmt = conn.prepareStatement(
-                "UPDATE xml_elements SET nodedata = ? WHERE nodeid = ?");
+                "UPDATE xml_nodes SET nodedata = ? WHERE nodeid = ?");
 
           // Bind the values to the query
           pstmt.setString(1, getContent());// The first ? is for NODEDATA
Index: xmltables.sql
===================================================================
--- xmltables.sql	(revision 19)
+++ xmltables.sql	(revision 20)
@@ -13,35 +13,33 @@
 /*
  * Drop all of the objects in proper order
  */
-DROP SEQUENCE xml_attributes_id_seq;
-DROP TRIGGER xml_attributes_before_insert;
-DROP SEQUENCE xml_elements_id_seq;
-DROP TRIGGER xml_elements_before_insert;
+DROP SEQUENCE xml_nodes_id_seq;
+DROP TRIGGER xml_nodes_before_insert;
 DROP TABLE xml_documents;
-DROP TABLE xml_attributes;
-DROP TABLE xml_elements;
+DROP TABLE xml_nodes;
 
 /* 
- * Elements -- table to store XML Elements
+ * Nodes -- table to store XML Nodes (both elements and attributes)
  */
-CREATE TABLE xml_elements (
+CREATE TABLE xml_nodes (
 	nodeid		NUMBER(20),
 	parentnodeid	NUMBER(20),
+	nodetype	VARCHAR2(2000),
 	nodename	VARCHAR2(2000),
 	nodedata	VARCHAR2(2000),
 	date_created	DATE,
 	date_updated	DATE,
-   CONSTRAINT xml_elements_pk PRIMARY KEY (nodeid),
-   CONSTRAINT xml_elements_parent_fk 
-		FOREIGN KEY (parentnodeid) REFERENCES xml_elements
+   CONSTRAINT xml_nodes_pk PRIMARY KEY (nodeid),
+   CONSTRAINT xml_nodes_parent_fk 
+		FOREIGN KEY (parentnodeid) REFERENCES xml_nodes
 );
 
-CREATE SEQUENCE xml_elements_id_seq;
+CREATE SEQUENCE xml_nodes_id_seq;
 
-CREATE TRIGGER xml_elements_before_insert
-BEFORE INSERT ON xml_elements FOR EACH ROW
+CREATE TRIGGER xml_nodes_before_insert
+BEFORE INSERT ON xml_nodes FOR EACH ROW
 BEGIN
-  SELECT xml_elements_id_seq.nextval
+  SELECT xml_nodes_id_seq.nextval
     INTO :new.nodeid
     FROM dual;
 END;
@@ -59,34 +57,6 @@
 	date_updated	DATE,
    CONSTRAINT xml_documents_pk PRIMARY KEY (docid),
    CONSTRAINT xml_documents_root_fk 
-		FOREIGN KEY (rootnodeid) REFERENCES xml_elements
+		FOREIGN KEY (rootnodeid) REFERENCES xml_nodes
 );
 
-/* 
- * Attributes -- table to store XML Attributes
- */
-CREATE TABLE xml_attributes (
-	attributeid	NUMBER(20),
-	nodeid		NUMBER(20),
-	attributenumber	NUMBER(20),
-	attributename	VARCHAR2(256),
-	attributevalue	VARCHAR2(2000),
-	date_created	DATE,
-	date_updated	DATE,
-   CONSTRAINT xml_attributes_pk PRIMARY KEY (attributeid),
-   CONSTRAINT xml_attributes_parent_node FOREIGN KEY (nodeid) 
-		REFERENCES xml_elements,
-   CONSTRAINT xml_attributes_uniq_attribute UNIQUE (nodeid,attributename) 
-);
-
-CREATE SEQUENCE xml_attributes_id_seq;
-
-CREATE TRIGGER xml_attributes_before_insert
-BEFORE INSERT ON xml_attributes FOR EACH ROW
-BEGIN
-  SELECT xml_attributes_id_seq.nextval
-    INTO :new.attributeid
-    FROM dual;
-END;
-/
-
Index: DBSAXElement.java
===================================================================
--- DBSAXElement.java	(revision 19)
+++ DBSAXElement.java	(revision 20)
@@ -42,18 +42,19 @@
           PreparedStatement pstmt;
           if (parent_id != 0) {
             pstmt = conn.prepareStatement(
-                "INSERT INTO xml_elements(nodeid, nodename, parentnodeid) " +
-                "VALUES (null, ?, ?)");
+                "INSERT INTO xml_nodes (nodeid, nodetype, " +
+                "nodename, parentnodeid) VALUES (null, ?, ?, ?)");
           } else {
             pstmt = conn.prepareStatement(
-                "INSERT INTO xml_elements(nodeid, nodename) " +
-                "VALUES (null, ?)");
+                "INSERT INTO xml_nodes (nodeid, nodetype, nodename) " +
+                "VALUES (null, ?, ?)");
           }
 
           // Bind the values to the query
-          pstmt.setString(1, getTagName());// The second ? is for NODENAME
+          pstmt.setString(1, "ELEMENT");
+          pstmt.setString(2, getTagName());
           if (parent_id != 0) {
-            pstmt.setLong(2, parent_id);
+            pstmt.setLong(3, parent_id);
           }
           // Do the insertion
           pstmt.execute();
@@ -72,7 +73,7 @@
         Statement stmt;
         try {
           stmt = conn.createStatement();
-          stmt.execute("SELECT xml_elements_id_seq.currval FROM dual");
+          stmt.execute("SELECT xml_nodes_id_seq.currval FROM dual");
           try {
             ResultSet rs = stmt.getResultSet();
             try {
@@ -140,14 +141,14 @@
         // And enter the attribute in the database
         try {
           PreparedStatement pstmt = conn.prepareStatement(
-              "INSERT INTO xml_attributes(attributeid, nodeid, " +
-              "attributename, attributevalue) " +
-              "VALUES (null, ?, ?, ?)");
+              "INSERT INTO xml_nodes (nodeid, nodetype, " +
+              "nodename, nodedata, parentnodeid) VALUES (null, ?, ?, ?, ?)");
 
           // Bind the values to the query
-          pstmt.setLong(1, getElementID());
+          pstmt.setString(1, "ATTRIBUTE");
           pstmt.setString(2, attName);
           pstmt.setString(3, attValue);
+          pstmt.setLong(4, getElementID());
  
           // Do the insertion
           pstmt.execute();
@@ -185,7 +186,7 @@
     public void writeContentToDB() {
         try {
           PreparedStatement pstmt = conn.prepareStatement(
-                "UPDATE xml_elements SET nodedata = ? WHERE nodeid = ?");
+                "UPDATE xml_nodes SET nodedata = ? WHERE nodeid = ?");
 
           // Bind the values to the query
           pstmt.setString(1, getContent());// The first ? is for NODEDATA
