1 package org.xmldb.xupdate.lexus.commands; 2 3 55 56 import org.w3c.dom.NamedNodeMap ; 57 import org.w3c.dom.Node ; 58 59 import java.util.Hashtable ; 60 import java.util.Vector ; 61 62 67 public abstract class InsertStates extends Object { 68 69 70 protected Hashtable attributes = null; 71 72 protected Vector characters = null; 73 74 75 78 public InsertStates() { 79 characters = new Vector (); 80 } 81 82 83 86 public void reset() { 87 characters.clear(); 88 } 89 90 91 94 public void submitAttributes(Hashtable attributes) { 95 this.attributes = attributes; 96 } 97 98 99 102 public void submitCharacters(String data) { 103 characters.addElement(data); 104 } 105 106 107 110 public abstract Node execute(Node contextNode) throws Exception ; 111 112 116 protected boolean hasDefaultNamespace(Node contextNode, String namespaceURI) { 117 Node context = contextNode; 118 while (context != null) { 119 if (context.hasAttributes()) { 120 NamedNodeMap attributes = context.getAttributes(); 121 Node attr = attributes.getNamedItemNS("http://www.w3.org/2000/xmlns/", "xmlns"); 122 if (attr != null) { 123 if (attr.getNodeValue().equals(namespaceURI)) { 124 return true; 125 } 126 } 127 } 128 context = context.getParentNode(); 129 } 130 return false; 131 } 132 } 133 134 | Popular Tags |