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.XMLGrammarPoolImpl from 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 final class 
    This class is a grammar pool entry.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    LSPXMLGrammarPool(int initialCapacity)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    cacheGrammars(String grammarType, org.apache.xerces.xni.grammars.Grammar[] grammars)
     
    void
     
    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.
    int
    hashCode(org.apache.xerces.xni.grammars.XMLGrammarDescription desc)
    Returns the hash code value for the given grammar description.
    void
     
    void
    removeGrammar(String grammarURI)
     
    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.
    org.apache.xerces.xni.grammars.Grammar
    retrieveGrammar(org.apache.xerces.xni.grammars.XMLGrammarDescription desc)
     
    org.apache.xerces.xni.grammars.Grammar[]
     
    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.
    void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LSPXMLGrammarPool

      public LSPXMLGrammarPool()
    • LSPXMLGrammarPool

      public LSPXMLGrammarPool(int initialCapacity)
  • Method Details

    • retrieveInitialGrammarSet

      public org.apache.xerces.xni.grammars.Grammar[] retrieveInitialGrammarSet(String grammarType)
      Specified by:
      retrieveInitialGrammarSet in interface org.apache.xerces.xni.grammars.XMLGrammarPool
    • cacheGrammars

      public void cacheGrammars(String grammarType, org.apache.xerces.xni.grammars.Grammar[] grammars)
      Specified by:
      cacheGrammars in interface org.apache.xerces.xni.grammars.XMLGrammarPool
    • retrieveGrammar

      public org.apache.xerces.xni.grammars.Grammar retrieveGrammar(org.apache.xerces.xni.grammars.XMLGrammarDescription desc)
      Specified by:
      retrieveGrammar in interface org.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:
      lockPool in interface org.apache.xerces.xni.grammars.XMLGrammarPool
    • unlockPool

      public void unlockPool()
      Specified by:
      unlockPool in interface org.apache.xerces.xni.grammars.XMLGrammarPool
    • clear

      public void clear()
      Specified by:
      clear in interface org.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 description
      desc2 - 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.