public Object run() { return new CharInfo(entitiesFileName, method, internal);} });
/** * Creates a new empty set of integers (characters) * @param max the maximum integer to be in the set. */ private int[] createEmptySetOfIntegers(int max) { firstWordNotUsed = 0; // an optimization int[] arr = new int[arrayIndex(max - 1) + 1]; return arr; }
/** * A base constructor just to explicitly create the fields, * with the exception of m_charToString which is handled * by the constructor that delegates base construction to this one. * <p> * m_charToString is not created here only for performance reasons, * to avoid creating a Hashtable that will be replaced when * making a mutable copy, {@link #mutableCopyOf(CharInfo)}. * */ private CharInfo() { this.array_of_bits = createEmptySetOfIntegers(65535); this.firstWordNotUsed = 0; this.shouldMapAttrChar_ASCII = new boolean[ASCII_MAX]; this.shouldMapTextChar_ASCII = new boolean[ASCII_MAX]; this.m_charKey = new CharKey(); // Not set here, but in a constructor that uses this one // this.m_charToString = new Hashtable(); this.onlyQuotAmpLtGt = true; return; }
/** * Call this method to register a char to String mapping, for example * to map '<' to "<". * @param outputString The String to map to. * @param inputChar The char to map from. * @return true if the mapping is not one of: * <ul> * <li> '<' to "<" * <li> '>' to ">" * <li> '&' to "&" * <li> '"' to """ * </ul> */ boolean defineChar2StringMapping(String outputString, char inputChar) { CharKey character = new CharKey(inputChar); m_charToString.put(character, outputString); set(inputChar); // mark the character has having a mapping to a String boolean extraMapping = extraEntity(outputString, inputChar); return extraMapping; }
if ((fromTextNode && m_charInfo.shouldMapTextChar(ch)) || (!fromTextNode && m_charInfo.shouldMapAttrChar(ch))) String outputStringForChar = m_charInfo.getOutputStringForChar(ch);
return mutableCopyOf(charInfo); charInfo = getCharInfoBasedOnPrivilege(entitiesFileName, method, true); return mutableCopyOf(charInfo); } catch (Exception e) {} return getCharInfoBasedOnPrivilege(entitiesFileName, method, false); } catch (Exception e) {} return getCharInfoBasedOnPrivilege(entitiesFileName, method, false);
/** * Tell if the character argument that is from * an attribute value has a mapping to a String. * * @param value the value of a character that is in an attribute value * @return true if the character should have any special treatment, * such as when writing out entity references. * @xsl.usage internal */ final boolean shouldMapAttrChar(int value) { // for performance try the values in the boolean array first, // this is faster access than the BitSet for common ASCII values if (value < ASCII_MAX) return shouldMapAttrChar_ASCII[value]; // rather than java.util.BitSet, our private // implementation is faster (and less general). return get(value); }
/** * Defines a new character reference. The reference's name and value are * supplied. Nothing happens if the character reference is already defined. * <p>Unlike internal entities, character references are a string to single * character mapping. They are used to map non-ASCII characters both on * parsing and printing, primarily for HTML documents. '&lt;' is an * example of a character reference.</p> * * @param name The entity's name * @param value The entity's value * @return true if the mapping is not one of: * <ul> * <li> '<' to "<" * <li> '>' to ">" * <li> '&' to "&" * <li> '"' to """ * </ul> */ private boolean defineEntity(String name, char value) { StringBuffer sb = new StringBuffer("&"); sb.append(name); sb.append(';'); String entityString = sb.toString(); boolean extra = defineChar2StringMapping(entityString, value); return extra; }
(String) format.get(OutputKeys.METHOD); m_charInfo = CharInfo.getCharInfo(entitiesFileName, method);
String value = entities.getString(name); int code = Integer.parseInt(value); boolean extra = defineEntity(name, (char) code); if (extra) noExtraEntities = false; boolean extra = defineEntity(name, (char) code); if (extra) noExtraEntities = false;
if (escapingNotNeeded(ch) && (!m_charInfo.shouldMapAttrChar(ch))) String outputStringForChar = m_charInfo.getOutputStringForChar(ch); if (null != outputStringForChar)
char ch1 = chars[i]; if (m_charInfo.shouldMapTextChar(ch1)) { .getOutputStringForChar(ch1); writer.write(outputStringForChar); if (m_charInfo.shouldMapTextChar(ch)) { String outputStringForChar = m_charInfo.getOutputStringForChar(ch); writer.write(outputStringForChar); lastDirtyCharProcessed = i;
if ((fromTextNode && m_charInfo.shouldMapTextChar(ch)) || (!fromTextNode && m_charInfo.shouldMapAttrChar(ch))) String outputStringForChar = m_charInfo.getOutputStringForChar(ch);
/** * Call this method to register a char to String mapping, for example * to map '<' to "<". * @param outputString The String to map to. * @param inputChar The char to map from. * @return true if the mapping is not one of: * <ul> * <li> '<' to "<" * <li> '>' to ">" * <li> '&' to "&" * <li> '"' to """ * </ul> */ boolean defineChar2StringMapping(String outputString, char inputChar) { CharKey character = new CharKey(inputChar); m_charToString.put(character, outputString); set(inputChar); // mark the character has having a mapping to a String boolean extraMapping = extraEntity(outputString, inputChar); return extraMapping; }
return mutableCopyOf(charInfo); charInfo = getCharInfoBasedOnPrivilege(entitiesFileName, method, true); return mutableCopyOf(charInfo); } catch (Exception e) {} return getCharInfoBasedOnPrivilege(entitiesFileName, method, false); } catch (Exception e) {} return getCharInfoBasedOnPrivilege(entitiesFileName, method, false);
/** * Tell if the character argument that is from a * text node has a mapping to a String, for example * to map '<' to "<". * * @param value the value of a character that is in a text node * @return true if the character has a mapping to a String, * such as when writing out entity references. * @xsl.usage internal */ final boolean shouldMapTextChar(int value) { // for performance try the values in the boolean array first, // this is faster access than the BitSet for common ASCII values if (value < ASCII_MAX) return shouldMapTextChar_ASCII[value]; // rather than java.util.BitSet, our private // implementation is faster (and less general). return get(value); }
/** * Defines a new character reference. The reference's name and value are * supplied. Nothing happens if the character reference is already defined. * <p>Unlike internal entities, character references are a string to single * character mapping. They are used to map non-ASCII characters both on * parsing and printing, primarily for HTML documents. '&lt;' is an * example of a character reference.</p> * * @param name The entity's name * @param value The entity's value * @return true if the mapping is not one of: * <ul> * <li> '<' to "<" * <li> '>' to ">" * <li> '&' to "&" * <li> '"' to """ * </ul> */ private boolean defineEntity(String name, char value) { StringBuffer sb = new StringBuffer("&"); sb.append(name); sb.append(';'); String entityString = sb.toString(); boolean extra = defineChar2StringMapping(entityString, value); return extra; }
(String) format.get(OutputKeys.METHOD); m_charInfo = CharInfo.getCharInfo(entitiesFileName, method);
String value = entities.getString(name); int code = Integer.parseInt(value); boolean extra = defineEntity(name, (char) code); if (extra) noExtraEntities = false; boolean extra = defineEntity(name, (char) code); if (extra) noExtraEntities = false;
if ((fromTextNode && m_charInfo.shouldMapTextChar(ch)) || (!fromTextNode && m_charInfo.shouldMapAttrChar(ch))) String outputStringForChar = m_charInfo.getOutputStringForChar(ch);