Class EntityHelper

java.lang.Object
  |
  +--EntityHelper

public class EntityHelper
extends java.lang.Object

This class provides utility services to assist with entity management for an XML document.

Version:
$03/11/29 03:25:49 mdh$
Author:
Malcolm D. Hyman

Field Summary
static int MAX_ENTITY_SUBST_LENGTH
           
 
Constructor Summary
EntityHelper(org.w3c.dom.Document doc, DocSpec spec)
           
EntityHelper(org.w3c.dom.Document doc, DocSpec spec, java.util.Map entityMap)
           
 
Method Summary
 java.lang.String entitize(java.lang.String source)
          Entitizes a string.
 java.util.Map getEntityMap()
          Returns the entityMap.
 int getKnownEntities()
          Returns the number of known entities.
 org.w3c.dom.Document makeEntitized()
          Inserts entities into all text nodes in a DOM.
 void normalize()
          Normalizes the document.
 void recursivelyEntitize(org.w3c.dom.Node node)
          Recursively traverses the tree, inserting entity reference nodes where it is possible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_ENTITY_SUBST_LENGTH

public static final int MAX_ENTITY_SUBST_LENGTH
Constructor Detail

EntityHelper

public EntityHelper(org.w3c.dom.Document doc,
                    DocSpec spec)

EntityHelper

public EntityHelper(org.w3c.dom.Document doc,
                    DocSpec spec,
                    java.util.Map entityMap)
Method Detail

normalize

public void normalize()
Normalizes the document.

entitize

public java.lang.String entitize(java.lang.String source)
Entitizes a string.
Parameters:
source - source string
Returns:
source with symbolic entities substituted

makeEntitized

public org.w3c.dom.Document makeEntitized()
Inserts entities into all text nodes in a DOM.
Returns:
DOM with entity substitutions

recursivelyEntitize

public void recursivelyEntitize(org.w3c.dom.Node node)
Recursively traverses the tree, inserting entity reference nodes where it is possible.
Parameters:
node - root of a subtree

getEntityMap

public java.util.Map getEntityMap()
Returns the entityMap.
Returns:
entity substitution map

getKnownEntities

public int getKnownEntities()
Returns the number of known entities.
Returns:
number of known entities