/** * Create an empty KeyIndex in the DOM case * @param name is the name of the index (the key or ##id) * @param dom is the DOM */ public void buildKeyIndex(String name, DOM dom) { if (_keyIndexes == null) _keyIndexes = new Hashtable(); KeyIndex index = (KeyIndex)_keyIndexes.get(name); if (index == null) { _keyIndexes.put(name, index = new KeyIndex(_indexSize)); } index.setDom(dom); }
/** * Clears the attribute list */ public void clear() { _length = 0; if (_attributes != null) { _attributes.clear(); _names.removeAllElements(); _values.removeAllElements(); _qnames.removeAllElements(); _uris.removeAllElements(); } }
/** * Returns a rather long string representation of this hashtable. * Handy for debugging - leave it here!!! */ public String toString() { int i; int max = size() - 1; StringBuffer buf = new StringBuffer(); Enumeration k = keys(); Enumeration e = elements(); buf.append("{"); for (i = 0; i <= max; i++) { String s1 = k.nextElement().toString(); String s2 = e.nextElement().toString(); buf.append(s1 + "=" + s2); if (i < max) buf.append(", "); } buf.append("}"); return buf.toString(); }
public Class getAuxiliaryClass(String className) { if (_auxClasses == null) return null; return((Class)_auxClasses.get(className)); }
/** * SAX2: Receive notification of the beginning of a document. */ public void startDocument() throws SAXException { super.startDocument(); _nsIndex.put(new Integer(0), new Integer(_uriCount++)); definePrefixAndUri(XML_PREFIX, XML_URI); }
/** * Construct an adapter connecting the <code>DTMWSFilter</code> interface * to the <code>StripFilter</code> interface. * * @param translet A translet that also implements the StripFilter * interface. * * @see org.apache.xml.dtm.DTMWSFilter * @see org.apache.xalan.xsltc.StripFilter */ public DOMWSFilter(AbstractTranslet translet) { m_translet = translet; m_mappings = new Hashtable(); if (translet instanceof StripFilter) { m_filter = (StripFilter) translet; } }
/** * The translet stores all CDATA sections set in the <xsl:output> element * in a Hashtable. This method will re-construct the whitespace separated * list of elements given in the <xsl:output> element. */ private String makeCDATAString(Hashtable cdata) { // Return a 'null' string if no CDATA section elements were specified if (cdata == null) return null; StringBuffer result = new StringBuffer(); // Get an enumeration of all the elements in the hashtable Enumeration elements = cdata.keys(); if (elements.hasMoreElements()) { result.append((String)elements.nextElement()); while (elements.hasMoreElements()) { String element = (String)elements.nextElement(); result.append(' '); result.append(element); } } return(result.toString()); }
/** * Adds a DecimalFormat object to the _formatSymbols hashtable. * The entry is created with the input DecimalFormatSymbols. */ public void addDecimalFormat(String name, DecimalFormatSymbols symbols) { // Instanciate hashtable for formatting symbols if needed if (_formatSymbols == null) _formatSymbols = new Hashtable(); // The name cannot be null - use empty string instead if (name == null) name = EMPTYSTRING; // Construct a DecimalFormat object containing the symbols we got final DecimalFormat df = new DecimalFormat(); if (symbols != null) { df.setDecimalFormatSymbols(symbols); } _formatSymbols.put(name, df); }
/** * Retrieves a named DecimalFormat object from _formatSymbols hashtable. */ public final DecimalFormat getDecimalFormat(String name) { if (_formatSymbols != null) { // The name cannot be null - use empty string instead if (name == null) name = EMPTYSTRING; DecimalFormat df = (DecimalFormat)_formatSymbols.get(name); if (df == null) df = (DecimalFormat)_formatSymbols.get(EMPTYSTRING); return df; } return(null); }
/** * Adds an attribute to the list */ public void add(String qname, String value) { // Initialize the internal vectors at the first usage. if (_attributes == null) alloc(); // Stuff the QName into the names vector & hashtable Integer obj = (Integer)_attributes.get(qname); if (obj == null) { _attributes.put(qname, obj = new Integer(_length++)); _qnames.addElement(qname); _values.addElement(value); int col = qname.lastIndexOf(':'); if (col > -1) { _uris.addElement(qname.substring(0,col)); _names.addElement(qname.substring(col+1)); } else { _uris.addElement(EMPTYSTRING); _names.addElement(qname); } } else { final int index = obj.intValue(); _values.set(index, value); } }
/** * Specialized interface used by DOM2SAX. This one has an extra Node * parameter to build the Node -> id map. */ public void startElement(String uri, String localName, String qname, Attributes attributes, Node node) throws SAXException { this.startElement(uri, localName, qname, attributes); if (m_buildIdIndex) { _node2Ids.put(node, new Integer(m_parents.peek())); } }
/** * Allocate memory for the AttributeList * %OPT% Use on-demand allocation for the internal vectors. The memory * is only allocated when there is an attribute. This reduces the cost * of creating many small RTFs. */ private void alloc() { _attributes = new Hashtable(); _names = new Vector(); _values = new Vector(); _qnames = new Vector(); _uris = new Vector(); }
/** * The translet stores all CDATA sections set in the <xsl:output> element * in a Hashtable. This method will re-construct the whitespace separated * list of elements given in the <xsl:output> element. */ private String makeCDATAString(Hashtable cdata) { // Return a 'null' string if no CDATA section elements were specified if (cdata == null) return null; StringBuffer result = new StringBuffer(); // Get an enumeration of all the elements in the hashtable Enumeration elements = cdata.keys(); if (elements.hasMoreElements()) { result.append((String)elements.nextElement()); while (elements.hasMoreElements()) { String element = (String)elements.nextElement(); result.append(' '); result.append(element); } } return(result.toString()); }
/** * Adds a value to a key/id index * @param name is the name of the index (the key or ##id) * @param node is the node handle of the node to insert * @param value is the value that will look up the node in the given index */ public void buildKeyIndex(String name, int node, Object value) { if (_keyIndexes == null) _keyIndexes = new Hashtable(); KeyIndex index = (KeyIndex)_keyIndexes.get(name); if (index == null) { _keyIndexes.put(name, index = new KeyIndex(_indexSize)); } index.add(value, node, _currentRootForKeys); }