Package org.eclipse.lemminx.utils
Class DOMUtils
- java.lang.Object
-
- org.eclipse.lemminx.utils.DOMUtils
-
public class DOMUtils extends Object
DOM Utilities.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 booleanisDTD(String uri)Returns true if the given URI is a DTD and false 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 booleanisRelaxNGUriCompactSyntax(String uri)Returns true if the given URI is a RelaxNG grammar compact syntax and false otherwise.static booleanisRelaxNGUriXMLSyntax(String uri)Returns 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 booleanisXSD(String uri)Returns 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 booleanisXSL(String uri)Returns 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 SAXParserFactorynewSAXParserFactory()Returns an instance of SAX parser factory by disabling external entities declarations.
-
-
-
Method Detail
-
isXSD
public static boolean isXSD(DOMDocument document)
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
public static boolean isXSD(String uri)
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
public static boolean isRelaxNG(DOMDocument document)
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
public static boolean isRelaxNGXMLSyntax(DOMDocument document)
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
public static boolean isRelaxNGUriXMLSyntax(String uri)
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
public static boolean isRelaxNGUri(String uri)
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
public static boolean isRelaxNGUriCompactSyntax(String uri)
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
public static boolean isCatalog(DOMDocument document)
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
public static boolean isDTD(String uri)
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
public static boolean isXSL(DOMDocument document)
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
public static boolean isXSL(String uri)
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
public static boolean containsTextOnly(DOMElement element)
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, ParserConfigurationException
Returns 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
public static DOMElement findFirstChildElementByTagName(DOMElement element, String tagName)
-
createInputSource
public static InputSource createInputSource(DOMDocument document)
-
-