Class LSPXMLGrammarPool
- java.lang.Object
-
- org.eclipse.lemminx.extensions.contentmodel.participants.diagnostics.LSPXMLGrammarPool
-
- All Implemented Interfaces:
org.apache.xerces.xni.grammars.XMLGrammarPool
- Direct Known Subclasses:
LSPXMLGrammarPoolWrapper
public class LSPXMLGrammarPool extends Object implements org.apache.xerces.xni.grammars.XMLGrammarPool
LSP XML grammar pool.This class is a copy/paste of
org.apache.xerces.util.XMLGrammarPoolImpl.XMLGrammarPoolImplfrom Xerces adapated to use .lemminx cache.- Author:
- Jeffrey Rodriguez, IBM, Andy Clark, IBM, Neil Graham, IBM, Pavani Mukthipudi, Sun Microsystems, Neeraj Bajaj, SUN Microsystems, Angelo ZERR
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classLSPXMLGrammarPool.EntryThis class is a grammar pool entry.
-
Constructor Summary
Constructors Constructor Description LSPXMLGrammarPool()LSPXMLGrammarPool(int initialCapacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcacheGrammars(String grammarType, org.apache.xerces.xni.grammars.Grammar[] grammars)voidclear()booleanequals(org.apache.xerces.xni.grammars.XMLGrammarDescription desc1, org.apache.xerces.xni.grammars.XMLGrammarDescription desc2)This method checks whether two grammars are the same.inthashCode(org.apache.xerces.xni.grammars.XMLGrammarDescription desc)Returns the hash code value for the given grammar description.voidlockPool()voidremoveGrammar(String grammarURI)org.apache.xerces.xni.grammars.GrammarremoveGrammar(org.apache.xerces.xni.grammars.XMLGrammarDescription desc)Removes the grammar associated to the specified grammar description from the grammar pool and returns the removed grammar.org.apache.xerces.xni.grammars.GrammarretrieveGrammar(org.apache.xerces.xni.grammars.XMLGrammarDescription desc)org.apache.xerces.xni.grammars.Grammar[]retrieveInitialGrammarSet(String grammarType)booleansetInternalSubset(org.apache.xerces.impl.dtd.XMLDTDDescription desc, String internalSubset)Update the DTD internal subset entry for the given XML DTD description and return true if the cached DTD grammar internal subset is equal to the given internal subset and false otherwise.voidunlockPool()
-
-
-
Method Detail
-
retrieveInitialGrammarSet
public org.apache.xerces.xni.grammars.Grammar[] retrieveInitialGrammarSet(String grammarType)
- Specified by:
retrieveInitialGrammarSetin interfaceorg.apache.xerces.xni.grammars.XMLGrammarPool
-
cacheGrammars
public void cacheGrammars(String grammarType, org.apache.xerces.xni.grammars.Grammar[] grammars)
- Specified by:
cacheGrammarsin interfaceorg.apache.xerces.xni.grammars.XMLGrammarPool
-
retrieveGrammar
public org.apache.xerces.xni.grammars.Grammar retrieveGrammar(org.apache.xerces.xni.grammars.XMLGrammarDescription desc)
- Specified by:
retrieveGrammarin interfaceorg.apache.xerces.xni.grammars.XMLGrammarPool
-
removeGrammar
public org.apache.xerces.xni.grammars.Grammar removeGrammar(org.apache.xerces.xni.grammars.XMLGrammarDescription desc)
Removes the grammar associated to the specified grammar description from the grammar pool and returns the removed grammar. Currently, the root element name is used as the key for DTD grammars and the target namespace is used as the key for Schema grammars.- Parameters:
desc- The Grammar Description.- Returns:
- The removed grammar.
-
removeGrammar
public void removeGrammar(String grammarURI)
-
lockPool
public void lockPool()
- Specified by:
lockPoolin interfaceorg.apache.xerces.xni.grammars.XMLGrammarPool
-
unlockPool
public void unlockPool()
- Specified by:
unlockPoolin interfaceorg.apache.xerces.xni.grammars.XMLGrammarPool
-
clear
public void clear()
- Specified by:
clearin interfaceorg.apache.xerces.xni.grammars.XMLGrammarPool
-
equals
public boolean equals(org.apache.xerces.xni.grammars.XMLGrammarDescription desc1, org.apache.xerces.xni.grammars.XMLGrammarDescription desc2)This method checks whether two grammars are the same. Currently, we compare the root element names for DTD grammars and the target namespaces for Schema grammars. The application can override this behaviour and add its own logic.- Parameters:
desc1- The grammar descriptiondesc2- The grammar description of the grammar to be compared to- Returns:
- True if the grammars are equal, otherwise false
-
hashCode
public int hashCode(org.apache.xerces.xni.grammars.XMLGrammarDescription desc)
Returns the hash code value for the given grammar description.- Parameters:
desc- The grammar description- Returns:
- The hash code value
-
setInternalSubset
public boolean setInternalSubset(org.apache.xerces.impl.dtd.XMLDTDDescription desc, String internalSubset)Update the DTD internal subset entry for the given XML DTD description and return true if the cached DTD grammar internal subset is equal to the given internal subset and false otherwise.- Parameters:
desc- the XML DTD description.internalSubset- the internal subset.- Returns:
- true if the cached DTD grammar internal subset is equal to the given internal subset and false otherwise.
-
-