public class DOMUtils extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
containsTextOnly(DOMElement element)
Returns true if element contains only DOMText and false otherwise.
|
static DOMElement |
findFirstChildElementByTagName(DOMElement element,
String tagName) |
static boolean |
isCatalog(DOMDocument document)
Returns true if the XML document is a XML Catalog and false otherwise.
|
static boolean |
isDOMElement(DOMNode node,
String tagName) |
static boolean |
isDTD(String uri)
Returns true if the given URI is a DTD and false otherwise.
|
static boolean |
isRelaxNG(DOMDocument document)
Returns true if the XML document is a RelaxNG grammar and false otherwise.
|
static boolean |
isRelaxNGUri(String uri)
Returns true if the given URI is a RelaxNG grammar and false otherwise.
|
static boolean |
isRelaxNGUriCompactSyntax(String uri)
Returns true if the given URI is a RelaxNG grammar compact syntax and false
otherwise.
|
static boolean |
isRelaxNGUriXMLSyntax(String uri)
Returns true if the given URI is a RelaxNG grammar XML syntax and false
otherwise.
|
static boolean |
isRelaxNGXMLSyntax(DOMDocument document)
Returns true if the XML document is a RelaxNG grammar XML syntax and false
otherwise.
|
static boolean |
isXSD(DOMDocument document)
Returns true if the XML document is a XML Schema and false otherwise.
|
static boolean |
isXSD(String uri)
Returns true if the given URI is a XML Schema and false otherwise.
|
static DOMDocument |
loadDocument(String documentURI,
URIResolverExtensionManager resolverExtensionManager)
Returns the DOM document from the given XML Schema uri.
|
static SAXParserFactory |
newSAXParserFactory()
Returns an instance of SAX parser factory by disabling external entities
declarations.
|
public static boolean isXSD(DOMDocument document)
public static boolean isXSD(String uri)
uri
- the URI to checkpublic static boolean isRelaxNG(DOMDocument document)
public static boolean isRelaxNGXMLSyntax(DOMDocument document)
public static boolean isRelaxNGUriXMLSyntax(String uri)
uri
- the URI to checkpublic static boolean isRelaxNGUri(String uri)
uri
- the URI to checkpublic static boolean isRelaxNGUriCompactSyntax(String uri)
uri
- the URI to checkpublic static boolean isCatalog(DOMDocument document)
public static boolean isDTD(String uri)
uri
- the URI to checkpublic static boolean containsTextOnly(DOMElement element)
public static DOMDocument loadDocument(String documentURI, URIResolverExtensionManager resolverExtensionManager)
documentURI
- the schema URIresolverExtensionManager
- public static SAXParserFactory newSAXParserFactory() throws SAXNotRecognizedException, SAXNotSupportedException, ParserConfigurationException
SAXNotRecognizedException
SAXNotSupportedException
ParserConfigurationException
public static DOMElement findFirstChildElementByTagName(DOMElement element, String tagName)
Copyright © 2022. All rights reserved.