Class CatalogUtils
java.lang.Object
org.eclipse.lemminx.extensions.catalog.CatalogUtils
Utility functions for working with XML catalog documents
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic List<CatalogEntry> getCatalogEntries(DOMDocument document) Returns a list of all the catalog entries in the given document, or an empty list if the document is not a catalog.static DOMAttrgetCatalogEntryCatalog(DOMElement element) Returns the catalog attribute node of the given catalog entry or null if there is no catalog attributestatic DOMAttrgetCatalogEntryURI(DOMElement element) Returns the uri attribute node of the given catalog entry or null if there is no uri attributestatic StringReturns the catalog identifier value for the given entry element:systemIdfor<system>,publicIdfor<public>, andnamefor<uri>.static StringgetCatalogIdentifier(CatalogEntry entry) Returns the catalog key attribute value for the given entry:systemIdfor<system>,publicIdfor<public>, andnamefor<uri>.static DOMAttrReturns the identifier attribute node for the given catalog entry element: thesystemIdattribute for<system>,publicIdfor<public>, andnamefor<uri>.static StringgetResolvedLocation(DOMDocument document, CatalogEntry catalogEntry) Returns the expanded system location
-
Constructor Details
-
CatalogUtils
public CatalogUtils()
-
-
Method Details
-
getCatalogEntries
Returns a list of all the catalog entries in the given document, or an empty list if the document is not a catalog.- Returns:
- a list of all the catalog entries in the given document, or an empty list if the document is not a catalog.
-
getCatalogEntryURI
Returns the uri attribute node of the given catalog entry or null if there is no uri attribute- Parameters:
element- The catalog entry to get the uri attribute of- Returns:
- the uri attribute node of the given catalog entry or null if there is no uri attribute
-
getCatalogEntryCatalog
Returns the catalog attribute node of the given catalog entry or null if there is no catalog attribute- Parameters:
element- The catalog entry to get the catalog attribute of- Returns:
- the catalog attribute node of the given catalog entry or null if there is no catalog attribute
-
getCatalogIdentifier
Returns the catalog key attribute value for the given entry:systemIdfor<system>,publicIdfor<public>, andnamefor<uri>. Returnsnullwhen the entry type has no such key (e.g.rewriteURI,namespace).This identifier is what XML instance files use to bind to the grammar:
xmlns="http://foo",SYSTEM "http://example.org/schema",PUBLIC "-//Ex//DTD//EN".- Parameters:
entry- the catalog entry.- Returns:
- the catalog identifier, or
nullif not applicable.
-
getCatalogIdentifier
Returns the catalog identifier value for the given entry element:systemIdfor<system>,publicIdfor<public>, andnamefor<uri>. Returnsnullwhen not applicable. -
getCatalogIdentifierAttr
Returns the identifier attribute node for the given catalog entry element: thesystemIdattribute for<system>,publicIdfor<public>, andnamefor<uri>. Returnsnullwhen the element type has no such key attribute. -
getResolvedLocation
Returns the expanded system location- Parameters:
document- the xml documentcatalogEntry- the catalog entry- Returns:
- the expanded system location
-