1 23 24 package com.sun.enterprise.deployment.node; 25 26 import org.xml.sax.Attributes ; 27 import org.xml.sax.helpers.NamespaceSupport ; 28 29 35 public class XMLElement extends java.lang.Object { 36 37 private String qName; 38 private String prefix=null; 39 private NamespaceSupport namespaces=null; 40 41 42 public XMLElement(String qName) { 43 this(qName, null); 44 } 45 46 public XMLElement(String qName, NamespaceSupport namespaceSupport) { 47 if (qName.indexOf(':')!=-1) { 48 prefix = qName.substring(0, qName.indexOf(':')); 49 this.qName = qName.substring(qName.indexOf(':')+1); 50 } else { 51 this.qName = qName; 52 } 53 namespaces = namespaceSupport; 55 } 56 57 public String getQName() { 58 return qName; 59 } 60 61 public String toString() { 62 return qName; 63 } 64 65 public String getPrefix() { 66 return prefix; 67 } 68 69 73 public String getPrefixURIMapping(String prefixToResolve) { 74 return ( (namespaces != null) && (prefixToResolve != null) ) ? 75 namespaces.getURI(prefixToResolve) : null; 76 } 77 78 public String getCompleteName() { 79 if (prefix!=null) { 80 return prefix+":"+qName; 81 } else { 82 return qName; 83 } 84 } 85 86 public boolean equals(XMLElement other ) { 87 return qName.equals(other.getQName()); 88 } 89 } 90 | Popular Tags |