Project

General

Profile

« Previous | Next » 

Revision 821

Added by bojilova over 22 years ago

added support for Namespaces.
Metacat now can store and retrieve XML documents with Namespaces.
Namespace is stored as separate record in xml_nodes table with type "NAMESPACE"
where nodename is the prefix and nodedata is the uri of the namespace.

View differences:

DBSAXNode.java
104 104
      }
105 105

  
106 106
      // Bind the values to the query
107
      // NOT USED; USED DBAdapter.getUniqueID() instead
108
      //long nid = generateNodeID();
109
      // NOT USED
110
      //let the db generate it: using identity key or through 
111
      //the db trigger xml_nodes_before_insert using sequence
112
      //long nid = dbAdapter.getUniqueID(conn, "xml_nodes");
113
      //pstmt.setLong(1, nid); 
114 107
      pstmt.setString(1, nodetype);
115 108
      pstmt.setString(2, nodename);
116 109
      pstmt.setString(3, docid);
......
126 119
        } else {
127 120
          pstmt.setLong(4, getRootNodeID());
128 121
          pstmt.setLong(5, getNodeID());
129
          // DON'T NEED to OVERRIDE THE meta_file_id TAGS with docid without rev
130
          // SINCE THE CLIENT INSERTS docids BEFORE SENDING THE doc TO METACAT
131
          //if ( nodetype == "TEXT" && getTagName().equals("meta_file_id") ) {
132
          //  pstmt.setString(6, getDocID());
133
          //} else {
134
            pstmt.setString(6, data);
135
          //}  
122
          pstmt.setString(6, data);
136 123
          pstmt.setInt(7, incChildNum());
137 124
        }
138 125
      }
......
252 239
    }
253 240
  }
254 241

  
242
  /** Add a namespace to this node */
243
  public void setNamespace(String prefix, String uri, String docid)
244
              throws SAXException {
245
    if (prefix != null) {
246
      // Enter the namespace in a hash table
247
      super.setNamespace(prefix, uri);
248
      // And enter the namespace in the database
249
      writeChildNodeToDB("NAMESPACE", prefix, uri, docid);
250
    } else {
251
      System.err.println("Namespace prefix must not be null!");
252
      throw new SAXException("Namespace prefix must not be null!");
253
    }
254
  }
255

  
255 256
  /** 
256 257
   * NOT USED
257 258
   * Update the node index (xml_index) for this node by generating

Also available in: Unified diff