Package io.jmix.core.common.xmlparsing
Class Dom4jTools
java.lang.Object
io.jmix.core.common.xmlparsing.Dom4jTools
Helper bean for XML parsing with DOM4J.
Caches SAXParser instances in the pool.
The pool size and timeout to borrow can be configured with the jmix.core.dom4jMaxPoolSize
and jmix.core.dom4jMaxBorrowWaitMillis
application properties.
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.apache.commons.pool2.impl.GenericObjectPool<SAXParser>
protected CoreProperties
protected javax.servlet.ServletContext
-
Constructor Summary
ConstructorDescriptionDom4jTools
(CoreProperties properties, javax.servlet.ServletContext servletContext) INTERNAL -
Method Summary
Modifier and TypeMethodDescriptionprotected org.dom4j.io.SAXReader
getSaxReader
(SAXParser saxParser) protected void
initPool()
void
org.dom4j.Document
readDocument
(File file) org.dom4j.Document
readDocument
(InputStream stream) org.dom4j.Document
readDocument
(Reader reader) org.dom4j.Document
readDocument
(String xmlString) void
shutdown()
Shuts down the pool, unregisters JMX.void
void
walkAttributes
(org.dom4j.Element element, Dom4j.ElementAttributeVisitor visitor) void
walkAttributesRecursive
(org.dom4j.Element element, Dom4j.ElementAttributeVisitor visitor) protected <T> T
withSAXParserFromPool
(Function<SAXParser, T> action) writeDocument
(org.dom4j.Document doc, boolean prettyPrint) void
writeDocument
(org.dom4j.Document doc, boolean prettyPrint, OutputStream stream) void
writeDocument
(org.dom4j.Document doc, boolean prettyPrint, Writer writer)
-
Field Details
-
properties
-
servletContext
protected javax.servlet.ServletContext servletContext -
pool
-
-
Constructor Details
-
Dom4jTools
@Autowired public Dom4jTools(CoreProperties properties, @Nullable javax.servlet.ServletContext servletContext) INTERNAL
-
-
Method Details
-
initPool
protected void initPool() -
shutdown
public void shutdown()Shuts down the pool, unregisters JMX. -
writeDocument
-
writeDocument
-
writeDocument
-
readDocument
-
readDocument
-
readDocument
-
readDocument
-
storeMap
-
loadMap
-
walkAttributesRecursive
public void walkAttributesRecursive(org.dom4j.Element element, Dom4j.ElementAttributeVisitor visitor) -
walkAttributes
-
getSaxReader
-
withSAXParserFromPool
-