Package org.eclipse.lemminx.utils
Class DOMUtils
java.lang.Object
org.eclipse.lemminx.utils.DOMUtils
DOM Utilities.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontainsTextOnly(DOMElement element) Returns true if element contains only DOMText and false otherwise.static InputSourcecreateInputSource(DOMDocument document) static DOMElementfindFirstChildElementByTagName(DOMElement element, String tagName) static booleanisCatalog(DOMDocument document) Returns true if the XML document is a XML Catalog and false otherwise.static booleanisDOMElement(DOMNode node, String tagName) static booleanReturns true if the given URI is a DTD and false otherwise.static booleanisNonEmptyRange(DOMRange range, boolean adjust) Returns false if the range is zero-length, and true otherwise.static booleanisRelaxNG(DOMDocument document) Returns true if the XML document is a RelaxNG grammar and false otherwise.static booleanisRelaxNGUri(String uri) Returns true if the given URI is a RelaxNG grammar and false otherwise.static booleanReturns true if the given URI is a RelaxNG grammar compact syntax and false otherwise.static booleanReturns true if the given URI is a RelaxNG grammar XML syntax and false otherwise.static booleanisRelaxNGXMLSyntax(DOMDocument document) Returns true if the XML document is a RelaxNG grammar XML syntax and false otherwise.static booleanReturns true if the given URI is a XML Schema and false otherwise.static booleanisXSD(DOMDocument document) Returns true if the XML document is a XML Schema and false otherwise.static booleanReturns true if the given URI is a XSL and false otherwise.static booleanisXSL(DOMDocument document) Returns true if the XML document is a XSL and false otherwise.static DOMDocumentloadDocument(String documentURI, URIResolverExtensionManager resolverExtensionManager) Returns the DOM document from the given XML Schema uri.static SAXParserFactoryReturns an instance of SAX parser factory by disabling external entities declarations.
-
Method Details
-
isXSD
Returns true if the XML document is a XML Schema and false otherwise.- Returns:
- true if the XML document is a XML Schema and false otherwise.
-
isXSD
Returns true if the given URI is a XML Schema and false otherwise.- Parameters:
uri- the URI to check- Returns:
- true if the given URI is a XML Schema and false otherwise.
-
isRelaxNG
Returns true if the XML document is a RelaxNG grammar and false otherwise.- Returns:
- true if the XML document is a RelaxNG grammar and false otherwise.
-
isRelaxNGXMLSyntax
Returns true if the XML document is a RelaxNG grammar XML syntax and false otherwise.- Returns:
- true if the XML document is a RelaxNG grammar XML syntax and false otherwise.
-
isRelaxNGUriXMLSyntax
Returns true if the given URI is a RelaxNG grammar XML syntax and false otherwise.- Parameters:
uri- the URI to check- Returns:
- true if the given URI is a RelaxNG grammar XML syntax and false otherwise.
-
isRelaxNGUri
Returns true if the given URI is a RelaxNG grammar and false otherwise.- Parameters:
uri- the URI to check- Returns:
- true if the given URI is a RelaxNG grammar and false otherwise.
-
isRelaxNGUriCompactSyntax
Returns true if the given URI is a RelaxNG grammar compact syntax and false otherwise.- Parameters:
uri- the URI to check- Returns:
- true if the given URI is a RelaxNG grammar compact syntax and false otherwise.
-
isCatalog
Returns true if the XML document is a XML Catalog and false otherwise.- Returns:
- true if the XML document is a XML Catalog and false otherwise.
-
isDTD
Returns true if the given URI is a DTD and false otherwise.- Parameters:
uri- the URI to check- Returns:
- true if the given URI is a DTD and false otherwise.
-
isXSL
Returns true if the XML document is a XSL and false otherwise.- Returns:
- true if the XML document is a XSL and false otherwise.
-
isXSL
Returns true if the given URI is a XSL and false otherwise.- Parameters:
uri- the URI to check- Returns:
- true if the given URI is a XSL and false otherwise.
-
containsTextOnly
Returns true if element contains only DOMText and false otherwise.- Returns:
- true if element contains only DOMText and false otherwise.
-
loadDocument
public static DOMDocument loadDocument(String documentURI, URIResolverExtensionManager resolverExtensionManager) Returns the DOM document from the given XML Schema uri.- Parameters:
documentURI- the schema URIresolverExtensionManager-- Returns:
- the DOM document from the given XML Schema uri.
-
newSAXParserFactory
public static SAXParserFactory newSAXParserFactory() throws SAXNotRecognizedException, SAXNotSupportedException, ParserConfigurationExceptionReturns an instance of SAX parser factory by disabling external entities declarations.- Returns:
- an instance of SAX parser factory by disabling external entities declarations.
- Throws:
SAXNotRecognizedExceptionSAXNotSupportedExceptionParserConfigurationException
-
findFirstChildElementByTagName
-
isDOMElement
-
createInputSource
-
isNonEmptyRange
Returns false if the range is zero-length, and true otherwise.- Parameters:
range- the range to checkadjust- true if the leading and trailing quotes should be removed before checking if it's zero-length, false otherwise- Returns:
- false if the range is zero-length, and true otherwise
-