/** * The Expanded Name table holds all of our Node names. The Base class * will add the common element types, need to call this function from * the derived class. * */ protected void createExpandedNameTable( ) { m_Document_TypeID = m_expandedNameTable.getExpandedTypeID(S_NAMESPACE, S_DOCUMENT, DTM.DOCUMENT_NODE); m_TextNode_TypeID = m_expandedNameTable.getExpandedTypeID(S_NAMESPACE, S_TEXT_NODE, DTM.TEXT_NODE); }
int namespaceID = m_expandedNameTable.getNamespaceID(expandedTypeID); if (null == m_expandedNameTable.getLocalName(expandedTypeID)) return "xmlns"; else return "xmlns:" + m_expandedNameTable.getLocalName(expandedTypeID); else if (0 == m_expandedNameTable.getLocalNameID(expandedTypeID)) return m_expandedNameTable.getLocalName(expandedTypeID);
/** * Given an expanded-name ID, return the namespace URI part. * * @param expandedNameID an ID that represents an expanded-name. * @return String URI value of this node's namespace, or null if no * namespace was resolved. */ public String getNamespaceFromExpandedNameID(int expandedNameID) { return m_expandedNameTable.getNamespace(expandedNameID); }
/** * Sets up a translet-to-dom type mapping table */ private int[] setupMapping(String[] names, String[] uris, int[] types, int nNames) { // Padding with number of names, because they // may need to be added, i.e for RTFs. See copy03 final int[] result = new int[m_expandedNameTable.getSize()]; for (int i = 0; i < nNames; i++) { //int type = getGeneralizedType(namesArray[i]); int type = m_expandedNameTable.getExpandedTypeID(uris[i], names[i], types[i], false); result[type] = type; } return result; }
/** * Add a node to the element indexes. The node will not be added unless * it's an element. * * @param expandedTypeID The expanded type ID of the node. * @param identity The node identity index. */ protected void indexNode(int expandedTypeID, int identity) { ExpandedNameTable ent = m_expandedNameTable; short type = ent.getType(expandedTypeID); if (DTM.ELEMENT_NODE == type) { int namespaceID = ent.getNamespaceID(expandedTypeID); int localNameID = ent.getLocalNameID(expandedTypeID); ensureSizeOfIndex(namespaceID, localNameID); int[] index = m_elemIndexes[namespaceID][localNameID]; index[index[0]] = identity; index[0]++; } }
int nsIndex = m_expandedNameTable.getNamespaceID(expandedTypeID); int lnIndex = m_expandedNameTable.getLocalNameID(expandedTypeID);
/** * Tell if the indexing is on and the given expanded type ID matches * what is in the indexes. Derived classes should call this before * calling {@link #getNextIndexed(int, int, int) getNextIndexed} method. * * @param expandedTypeID The expanded type ID being requested. * * @return true if it is OK to call the * {@link #getNextIndexed(int, int, int) getNextIndexed} method. */ protected final boolean isIndexed(int expandedTypeID) { return (m_indexing && ExpandedNameTable.ELEMENT == m_expandedNameTable.getType(expandedTypeID)); }
/** * Create an expanded name table. */ public ExpandedNameTable() { m_capacity = m_initialCapacity; m_threshold = (int)(m_capacity * m_loadFactor); m_table = new HashEntry[m_capacity]; initExtendedTypes(); }
/** * Given an expanded-name ID, return the local name part. * * @param expandedNameID an ID that represents an expanded-name. * @return String Local name of this node. */ public String getLocalNameFromExpandedNameID(int expandedNameID) { return m_expandedNameTable.getLocalName(expandedNameID); }
/** * Receive notification of the end of the document. * * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#endDocument */ public void endDocument() throws SAXException { super.endDocument(); // Add a NULL entry to the end of the node arrays as // the end indication. m_exptype.addElement(NULL); m_parent.addElement(NULL); m_nextsib.addElement(NULL); m_firstch.addElement(NULL); // Set the cached references after the document is built. m_extendedTypes = m_expandedNameTable.getExtendedTypes(); m_exptype_map = m_exptype.getMap(); m_nextsib_map = m_nextsib.getMap(); m_firstch_map = m_firstch.getMap(); m_parent_map = m_parent.getMap(); }
int namespaceID = m_expandedNameTable.getNamespaceID(expandedTypeID); String name = m_expandedNameTable.getLocalName(expandedTypeID);
/** * Returns the namespace type of a specific node * @param nodeHandle the id of the node. * @return the ID of the namespace. */ public int getNamespaceType(final int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); int expandedNameID = _exptype(identity); return m_expandedNameTable.getNamespaceID(expandedNameID); }
rehash(); index = hash % m_capacity; if (index < 0)
/** * Add a node to the element indexes. The node will not be added unless * it's an element. * * @param expandedTypeID The expanded type ID of the node. * @param identity The node identity index. */ protected void indexNode(int expandedTypeID, int identity) { ExpandedNameTable ent = m_expandedNameTable; short type = ent.getType(expandedTypeID); if (DTM.ELEMENT_NODE == type) { int namespaceID = ent.getNamespaceID(expandedTypeID); int localNameID = ent.getLocalNameID(expandedTypeID); ensureSizeOfIndex(namespaceID, localNameID); int[] index = m_elemIndexes[namespaceID][localNameID]; index[index[0]] = identity; index[0]++; } }
int nsIndex = m_expandedNameTable.getNamespaceID(expandedTypeID); int lnIndex = m_expandedNameTable.getLocalNameID(expandedTypeID);
/** * Tell if the indexing is on and the given expanded type ID matches * what is in the indexes. Derived classes should call this before * calling {@link #getNextIndexed(int, int, int) getNextIndexed} method. * * @param expandedTypeID The expanded type ID being requested. * * @return true if it is OK to call the * {@link #getNextIndexed(int, int, int) getNextIndexed} method. */ protected final boolean isIndexed(int expandedTypeID) { return (m_indexing && ExpandedNameTable.ELEMENT == m_expandedNameTable.getType(expandedTypeID)); }
/** * Create an expanded name table. */ public ExpandedNameTable() { m_capacity = m_initialCapacity; m_threshold = (int)(m_capacity * m_loadFactor); m_table = new HashEntry[m_capacity]; initExtendedTypes(); }
/** * Given an expanded-name ID, return the local name part. * * @param expandedNameID an ID that represents an expanded-name. * @return String Local name of this node. */ public String getLocalNameFromExpandedNameID(int expandedNameID) { return m_expandedNameTable.getLocalName(expandedNameID); }
/** * Receive notification of the end of the document. * * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#endDocument */ public void endDocument() throws SAXException { super.endDocument(); // Add a NULL entry to the end of the node arrays as // the end indication. m_exptype.addElement(NULL); m_parent.addElement(NULL); m_nextsib.addElement(NULL); m_firstch.addElement(NULL); // Set the cached references after the document is built. m_extendedTypes = m_expandedNameTable.getExtendedTypes(); m_exptype_map = m_exptype.getMap(); m_nextsib_map = m_nextsib.getMap(); m_firstch_map = m_firstch.getMap(); m_parent_map = m_parent.getMap(); }