1 package com.icl.saxon.tinytree; 2 import com.icl.saxon.om.*; 3 import com.icl.saxon.output.Outputter; 4 import com.icl.saxon.Context; 5 import org.w3c.dom.Node ; 6 import javax.xml.transform.TransformerException ; 7 13 14 final class TinyNamespaceImpl extends TinyNodeImpl { 15 16 private int parentNode; private int nameCode; 26 public TinyNamespaceImpl(TinyDocumentImpl doc, int nodeNr) { 27 document = doc; 28 this.nodeNr = nodeNr; 29 nameCode = document.getNamePool().allocate("", "", getLocalName()); 30 } 31 32 35 36 public int getNamespaceCode() { 37 return document.namespaceCode[nodeNr]; 38 } 39 40 43 44 public int getFingerprint() { 45 return nameCode & 0xfffff; 46 } 47 48 51 52 protected void setParentNode(int nodeNr) { 53 parentNode = nodeNr; 54 } 55 56 59 60 public int getNameCode() { 61 return nameCode; 62 } 63 64 68 69 public String getPrefix() { 70 return null; 71 } 72 73 78 79 public String getDisplayName() { 80 return getLocalName(); 81 } 82 83 87 88 public String getLocalName() { 89 return document.getNamePool().getPrefixFromNamespaceCode( 90 document.namespaceCode[nodeNr]); 91 } 92 93 97 98 public String getURI() { 99 return null; 100 } 101 102 105 106 public NodeInfo getParent() { 107 return document.getNode(parentNode); 108 } 109 110 115 116 public final boolean isSameNode(NodeInfo other) { 117 if (!(other instanceof TinyNamespaceImpl)) return false; 118 if (this==other) return true; 119 TinyNamespaceImpl otherN = (TinyNamespaceImpl)other; 120 return (this.parentNode==((TinyNamespaceImpl)other).parentNode && 121 this.document==otherN.document && 122 this.nodeNr==((TinyNamespaceImpl)other).nodeNr); 123 } 124 125 129 130 public final short getNodeType() { 131 return NAMESPACE; 132 } 133 134 138 139 public final String getStringValue() { 140 return document.getNamePool().getURIFromNamespaceCode( 141 document.namespaceCode[nodeNr]); 142 } 143 144 147 148 public String generateId() { 149 return (getParent()).generateId() + "_xmlns_" + getLocalName(); 150 } 151 152 155 156 public void copy(Outputter out) throws TransformerException { 157 out.copyNamespaceNode(getNamespaceCode()); 158 } 159 160 166 167 protected long getSequenceNumber() { 168 return ((TinyNodeImpl)getParent()).getSequenceNumber() + nodeNr + 1; 169 } 170 171 } 172 173 | Popular Tags |