|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xerces.dom.DOMNormalizer
This class adds implementation for normalizeDocument method. It acts as if the document was going through a save and load cycle, putting the document in a "normal" form. The actual result depends on the features being set and governing what operations actually take place. See setNormalizationFeature for details. Noticeably this method normalizes Text nodes, makes the document "namespace wellformed", according to the algorithm described below in pseudo code, by adding missing namespace declaration attributes and adding or changing namespace prefixes, updates the replacement tree of EntityReference nodes, normalizes attribute values, etc. Mutation events, when supported, are generated to reflect the changes occuring on the document. See Namespace normalization for details on how namespace declaration attributes and prefixes are normalized. NOTE: There is an initial support for DOM revalidation with XML Schema as a grammar. The tree might not be validated correctly if entityReferences, CDATA sections are present in the tree. The PSVI information is not exposed, normalized data (including element default content is not available).
Nested Class Summary | |
protected class |
DOMNormalizer.XMLAttributesProxy
|
Field Summary | |
protected static boolean |
DEBUG
Debug namespace fix up algorithm |
protected static boolean |
DEBUG_ND
Debug normalize document |
protected static java.lang.String |
ERROR_HANDLER
Property identifier: error handler. |
protected java.util.Vector |
fAttributeList
list of attributes |
protected DOMNormalizer.XMLAttributesProxy |
fAttrProxy
|
protected CoreDocumentImpl |
fDocument
|
protected DOMErrorImpl |
fDOMError
DOM Error object |
protected java.lang.String |
fEmptySymbol
|
protected org.w3c.dom.DOMErrorHandler |
fErrorHandler
error handler |
protected org.apache.xerces.xni.grammars.Grammar[] |
fGrammarPool
|
protected NamespaceSupport |
fLocalNSBinder
stores all namespace bindings on the current element |
protected NamespaceSupport |
fNamespaceBinder
stores namespaces in scope |
protected int |
fNamespaceCounter
|
protected org.apache.xerces.xni.QName |
fQName
|
protected SymbolTable |
fSymbolTable
symbol table |
protected RevalidationHandler |
fValidationHandler
Validation handler represents validator instance. |
protected java.lang.String |
fXmlnsSymbol
|
protected java.lang.String |
fXmlSymbol
|
protected static java.lang.String |
PREFIX
prefix added by namespace fixup algorithm should follow a pattern "NS" + index |
protected static java.lang.String |
SYMBOL_TABLE
Property identifier: symbol table. |
Constructor Summary | |
DOMNormalizer()
|
Method Summary | |
protected void |
addNamespaceDecl(java.lang.String prefix,
java.lang.String uri,
ElementImpl element)
Adds a namespace attribute or replaces the value of existing namespace attribute with the given prefix and value for URI. |
void |
cacheGrammars(java.lang.String grammarType,
org.apache.xerces.xni.grammars.Grammar[] grammars)
|
void |
clear()
|
protected void |
expandEntityRef(org.w3c.dom.Node node,
org.w3c.dom.Node parent,
org.w3c.dom.Node reference)
|
void |
lockPool()
|
protected org.w3c.dom.DOMError |
modifyDOMError(java.lang.String message,
short severity,
org.w3c.dom.Node node)
|
protected void |
namespaceFixUp(ElementImpl element,
AttributeMap attributes)
|
protected void |
normalizeDocument(CoreDocumentImpl document)
Normalizes document. |
protected org.w3c.dom.Node |
normalizeNode(org.w3c.dom.Node node)
This method acts as if the document was going through a save and load cycle, putting the document in a "normal" form. |
protected void |
removeDefault(org.w3c.dom.Attr attribute,
AttributeMap attrMap)
|
protected void |
reset(org.apache.xerces.xni.parser.XMLComponentManager componentManager)
|
org.apache.xerces.xni.grammars.Grammar |
retrieveGrammar(org.apache.xerces.xni.grammars.XMLGrammarDescription desc)
|
org.apache.xerces.xni.grammars.Grammar[] |
retrieveInitialGrammarSet(java.lang.String grammarType)
|
protected void |
setValidationHandler(RevalidationHandler validator)
|
void |
unlockPool()
|
protected void |
updateQName(org.w3c.dom.Node node,
org.apache.xerces.xni.QName qname)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final boolean DEBUG_ND
protected static final boolean DEBUG
protected static final java.lang.String PREFIX
protected static final java.lang.String ERROR_HANDLER
protected static final java.lang.String SYMBOL_TABLE
protected CoreDocumentImpl fDocument
protected final DOMNormalizer.XMLAttributesProxy fAttrProxy
protected final org.apache.xerces.xni.QName fQName
protected RevalidationHandler fValidationHandler
protected SymbolTable fSymbolTable
protected org.w3c.dom.DOMErrorHandler fErrorHandler
protected java.lang.String fEmptySymbol
protected java.lang.String fXmlSymbol
protected java.lang.String fXmlnsSymbol
protected int fNamespaceCounter
protected final NamespaceSupport fNamespaceBinder
protected final NamespaceSupport fLocalNSBinder
protected final java.util.Vector fAttributeList
protected final DOMErrorImpl fDOMError
protected final org.apache.xerces.xni.grammars.Grammar[] fGrammarPool
Constructor Detail |
public DOMNormalizer()
Method Detail |
protected void reset(org.apache.xerces.xni.parser.XMLComponentManager componentManager)
protected void setValidationHandler(RevalidationHandler validator)
protected void normalizeDocument(CoreDocumentImpl document)
protected org.w3c.dom.Node normalizeNode(org.w3c.dom.Node node)
node
- Modified node or null. If node is returned, we need
to normalize again starting on the node returned.
protected void expandEntityRef(org.w3c.dom.Node node, org.w3c.dom.Node parent, org.w3c.dom.Node reference)
protected void namespaceFixUp(ElementImpl element, AttributeMap attributes)
protected void addNamespaceDecl(java.lang.String prefix, java.lang.String uri, ElementImpl element)
prefix
- uri
-
IOException
protected void removeDefault(org.w3c.dom.Attr attribute, AttributeMap attrMap)
protected org.w3c.dom.DOMError modifyDOMError(java.lang.String message, short severity, org.w3c.dom.Node node)
protected void updateQName(org.w3c.dom.Node node, org.apache.xerces.xni.QName qname)
public org.apache.xerces.xni.grammars.Grammar[] retrieveInitialGrammarSet(java.lang.String grammarType)
retrieveInitialGrammarSet
in interface org.apache.xerces.xni.grammars.XMLGrammarPool
public void cacheGrammars(java.lang.String grammarType, org.apache.xerces.xni.grammars.Grammar[] grammars)
cacheGrammars
in interface org.apache.xerces.xni.grammars.XMLGrammarPool
public org.apache.xerces.xni.grammars.Grammar retrieveGrammar(org.apache.xerces.xni.grammars.XMLGrammarDescription desc)
retrieveGrammar
in interface org.apache.xerces.xni.grammars.XMLGrammarPool
public void lockPool()
lockPool
in interface org.apache.xerces.xni.grammars.XMLGrammarPool
public void unlockPool()
unlockPool
in interface org.apache.xerces.xni.grammars.XMLGrammarPool
public void clear()
clear
in interface org.apache.xerces.xni.grammars.XMLGrammarPool
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |