Class ContentModelManager
java.lang.Object
org.eclipse.lemminx.extensions.contentmodel.model.ContentModelManager
Content model manager used to load XML Schema, DTD.
-
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 the given catalog URI is registered inxml.catalogs.booleanReturns true if external entities must be resolved and false otherwise.loadCMDocument(String grammarURI) Loads and returns the content model document for the given grammar URI (XSD, DTD, RelaxNG, etc.) and null otherwise.loadCMDocumentAsync(String grammarURI) Loads and returns the content model document for the given grammar URI asynchronously.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) voidsetWorkspaceFolderUris(List<String> workspaceFolderUris) Set the workspace folder URIs used for resolving variables in file associations.voidunregisterModelProvider(ContentModelProvider modelProvider)
-
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.
-
loadCMDocument
Loads and returns the content model document for the given grammar URI (XSD, DTD, RelaxNG, etc.) and null otherwise.- Parameters:
grammarURI- the grammar file URI.- Returns:
- the content model document for the given grammar URI and null otherwise.
-
loadCMDocumentAsync
Loads and returns the content model document for the given grammar URI asynchronously. If the grammar needs to be downloaded, returns a future that completes when the download finishes.- Parameters:
grammarURI- the grammar file URI.- Returns:
- a future that resolves to the content model document or null.
-
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
-
isRegisteredCatalog
Returns true if the given catalog URI is registered inxml.catalogs.- Parameters:
uri- the catalog document URI to check- Returns:
- true if registered
-
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
-
setWorkspaceFolderUris
Set the workspace folder URIs used for resolving variables in file associations.- Parameters:
workspaceFolderUris- the workspace folder URIs.
-
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.!
-