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:

BasicNode.java
41 41
    private long    rootnode_id;
42 42
    private String  doc_id;
43 43
    private Hashtable	attributes;
44
    private Hashtable	namespace;
44 45
    private int         childNum;
45 46
    private int         nodeIndex;
46 47
    private String      nodeType;
......
50 51
    public BasicNode () {
51 52
      children = new Vector();
52 53
      attributes = new Hashtable(); 
54
      namespace = new Hashtable(); 
53 55
      this.childNum = 0;
54 56
    }
55 57

  
......
197 199
      return (String)attributes.get(attName);
198 200
    }
199 201

  
202
    /** Add a namespace to this node */
203
    public void setNamespace(String prefix, String uri) {
204
      if (prefix != null) {
205
        // Enter the namespace in the hash table
206
        namespace.put(prefix, uri);
207
      } else {
208
        System.err.println("Namespace prefix must not be null!");
209
      }
210
    }
211

  
212
    /** Get an uri of the namespace prefix */
213
    public String getNamespace(String prefix) {
214
      return (String)namespace.get(prefix);
215
    }
216

  
200 217
    /** Get nodeIndex of the node */
201 218
    public int getNodeIndex() {
202 219
      return this.nodeIndex;

Also available in: Unified diff