Class ContentModelManager
java.lang.Object
org.eclipse.lemminx.extensions.contentmodel.model.ContentModelManager
Content model manager used to load XML Schema, DTD.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal Map<String,CMDocument> final LSPXMLGrammarPoolfinal List<ContentModelProvider>boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleandependsOnGrammar(DOMDocument document, String grammarURI) Returns true if the given document is linked to the given grammar URI (XML Schema, DTD) and false otherwise.voidRemove the cache directory (.lemminx/cache) if it exists and clear the Xerces grammar cache which stores the XSD, DTD grammars.voidevictCacheFor(DOMDocument document) Remove the referenced grammar from the given document and clear the Xerces grammar cache which stores the XSD, DTD grammar.expandSystemId(String path) Expand system IdfindCMDocument(DOMDocument xmlDocument, String namespaceURI) findCMDocument(DOMDocument xmlDocument, String namespaceURI, boolean withInternal) Returns the declared documents which match the given DOM document.findCMDocument(DOMElement element) Returns the owner document of the declared element which matches the given XML element and null otherwise.findCMDocument(DOMElement element, String namespaceURI) Returns the owner document of the declared element which matches the given XML element and null otherwise.voidForce the givenurlto download.String[]Get XML catalogs.Returns the model provider by the given uri and null otherwise.getReferencedGrammarInfos(DOMDocument document) Returns informations about all referenced grammar (XSD, DTD) from the given DOM document.booleanReturns true if the external resources can be downloaded and false otherwise.booleanReturns true if external entities must be resolved and false otherwise.voidRefresh the XML catalogs.voidregisterModelProvider(ContentModelProvider modelProvider) booleansetCatalogs(String[] catalogs) Set up XML catalogs.voidsetDownloadExternalResources(boolean downloadExternalResources) Set true if the external resources can be downloaded and false otherwise.booleansetFileAssociations(XMLFileAssociation[] fileAssociations) Set file associations.voidsetResolveExternalEntities(boolean resolveExternalEntities) Set true if external entities must be resolved and false otherwise.voidsetRootURI(String rootUri) voidsetUseCache(boolean useCache) voidunregisterModelProvider(ContentModelProvider modelProvider)
-
Field Details
-
cmDocumentCache
-
resolverManager
-
modelProviders
-
cacheResolverExtension
-
catalogResolverExtension
-
fileAssociationResolver
-
grammarPool
-
resolveExternalEntities
public boolean resolveExternalEntities
-
-
Constructor Details
-
ContentModelManager
-
-
Method Details
-
findCMDocument
Returns the owner document of the declared element which matches the given XML element and null otherwise.- Parameters:
element- the XML element- Returns:
- the owner document of the declared element which matches the given XML element and null otherwise.
-
findCMDocument
Returns the owner document of the declared element which matches the given XML element and null otherwise.- Parameters:
element- the XML element- Returns:
- the owner document of the declared element which matches the given XML element and null otherwise.
-
findCMDocument
-
findCMDocument
public Collection<CMDocument> findCMDocument(DOMDocument xmlDocument, String namespaceURI, boolean withInternal) Returns the declared documents which match the given DOM document.- Parameters:
xmlDocument- the DOM document.namespaceURI- the namespace URI- Returns:
- the declared documents which match the given DOM document.
-
dependsOnGrammar
Returns true if the given document is linked to the given grammar URI (XML Schema, DTD) and false otherwise.- Parameters:
document- the DOM documentgrammarURI- the grammar URI- Returns:
- true if the given document is linked to the given grammar URI (XML Schema, DTD) and false otherwise.
-
getReferencedGrammarInfos
Returns informations about all referenced grammar (XSD, DTD) from the given DOM document.In other words, it gives information about
- which XSD, DTD files are bound to the DOM document.
- which binding strategies are used (catalog, file association, xsi:schemaLocation, xsi:noNamespaceSchemaLocation, DOCTYPE).
- the cache file path (for remote grammar with http://)
- Parameters:
document- the DOM document.- Returns:
- informations about all referenced grammar (XSD, DTD) from the given DOM document.
-
getModelProviderByURI
Returns the model provider by the given uri and null otherwise.- Parameters:
uri- the grammar URI- Returns:
- the model provider by the given uri and null otherwise.
-
expandSystemId
Expand system Id- Parameters:
path- path to be expanded- Returns:
- the expanded system Id
-
getCatalogs
Get XML catalogs.- Returns:
- list of catalogs
-
setCatalogs
Set up XML catalogs.- Parameters:
catalogs- list of XML catalog files.- Returns:
- true if catalogs changed and false otherwise
-
refreshCatalogs
public void refreshCatalogs()Refresh the XML catalogs. -
setFileAssociations
Set file associations.- Parameters:
fileAssociations-- Returns:
- true if file associations changed and false otherwise
-
setRootURI
-
setUseCache
public void setUseCache(boolean useCache) -
isDownloadExternalResources
public boolean isDownloadExternalResources()Returns true if the external resources can be downloaded and false otherwise.- Returns:
- true if the external resources can be downloaded and false otherwise.
-
setDownloadExternalResources
public void setDownloadExternalResources(boolean downloadExternalResources) Set true if the external resources can be downloaded and false otherwise.- Parameters:
downloadExternalResources- the external resources
-
evictCacheFor
Remove the referenced grammar from the given document and clear the Xerces grammar cache which stores the XSD, DTD grammar.- Parameters:
document- the DOM document- Throws:
IOException- if the delete of grammar file cannot be done.
-
evictCache
Remove the cache directory (.lemminx/cache) if it exists and clear the Xerces grammar cache which stores the XSD, DTD grammars.- Throws:
IOException- if the delete of directory (.lemminx/cache) cannot be done.
-
registerModelProvider
-
unregisterModelProvider
-
getGrammarPool
-
isResolveExternalEntities
public boolean isResolveExternalEntities()Returns true if external entities must be resolved and false otherwise.- Returns:
- true if external entities must be resolved and false otherwise.
-
setResolveExternalEntities
public void setResolveExternalEntities(boolean resolveExternalEntities) Set true if external entities must be resolved and false otherwise.- Parameters:
resolveExternalEntities- resolve external entities
-
forceDownloadExternalResource
Force the givenurlto download.- Parameters:
url- the url to download.!
-