1 4 package gnu.kawa.xml; 5 import gnu.xml.*; 6 7 9 10 public class KElement extends KNode 11 12 14 { 15 public KElement (NodeTree seq, int ipos) 16 { 17 super(seq, ipos); 18 } 19 20 21 23 24 public String getTagName () 25 { 26 return sequence.getNextTypeName(ipos); 27 } 28 29 public String getNodeValue() 30 { 31 return null; 32 } 33 34 public boolean hasAttributes () 35 { 36 return ((NodeTree) sequence).posHasAttributes(ipos); 37 } 38 39 public String getAttribute (String name) 40 { 41 if (name == null) 42 name = ""; 43 NodeTree nodes = (NodeTree) sequence; 44 int attr = nodes.getAttribute(ipos, null, name); 45 if (attr == 0) 46 return ""; 47 else 48 return KNode.getNodeValue(nodes, attr); 49 } 50 51 52 60 68 77 85 93 94 95 97 98 100 public KAttr 101 102 103 getAttributeNode (String name) 104 { 105 if (name == null) 106 name = ""; 107 NodeTree nodes = (NodeTree) sequence; 108 int attr = nodes.getAttribute(ipos, null, name); 109 if (attr == 0) 110 return null; 111 else 112 return new KAttr(nodes, attr); 113 } 114 115 116 124 132 133 public String getAttributeNS (String namespaceURI, String localName) 134 { 135 if (namespaceURI == null) 136 namespaceURI = ""; 137 if (localName == null) 138 localName = ""; 139 NodeTree nodes = (NodeTree) sequence; 140 int attr = nodes.getAttribute(ipos, namespaceURI, localName); 141 if (attr == 0) 142 return ""; 143 else 144 return getNodeValue(nodes, attr); 145 } 146 147 148 156 157 158 166 167 168 170 171 173 public KAttr 174 175 176 getAttributeNodeNS(String namespaceURI, String localName) 177 { 178 if (namespaceURI == null) 179 namespaceURI = ""; 180 if (localName == null) 181 localName = ""; 182 NodeTree nodes = (NodeTree) sequence; 183 int attr = nodes.getAttribute(ipos, namespaceURI, localName); 184 if (attr == 0) 185 return null; 186 else 187 return new KAttr(nodes, attr); 188 } 189 190 191 192 199 200 202 207 208 209 public boolean hasAttribute (String name) 210 { 211 int attr = ((NodeTree) sequence).getAttribute(ipos, null, name == null ? "" : name); 212 return attr != 0; 213 } 214 215 public boolean hasAttributeNS (String namespaceURI, String localName) 216 { 217 if (namespaceURI == null) 218 namespaceURI = ""; 219 if (localName == null) 220 localName = ""; 221 int attr = ((NodeTree) sequence).getAttribute(ipos, namespaceURI, localName); 222 return attr != 0; 223 } 224 225 226 231 } 232 | Popular Tags |