Class DOMUtils

java.lang.Object
org.eclipse.lemminx.utils.DOMUtils

public class DOMUtils extends Object
DOM Utilities.
  • Method Details

    • 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.
    • 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 URI
      resolverExtensionManager -
      Returns:
      the DOM document from the given XML Schema uri.
    • newSAXParserFactory

      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:
      SAXNotRecognizedException
      SAXNotSupportedException
      ParserConfigurationException
    • findFirstChildElementByTagName

      public static DOMElement findFirstChildElementByTagName(DOMElement element, String tagName)
    • isDOMElement

      public static boolean isDOMElement(DOMNode node, String tagName)
    • createInputSource

      public static InputSource createInputSource(DOMDocument document)