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
FieldsModifier and TypeFieldDescriptionprotected org.apache.commons.pool2.impl.GenericObjectPool<SAXParser>protected CorePropertiesprotected javax.servlet.ServletContext -
Constructor Summary
ConstructorsConstructorDescriptionDom4jTools(CoreProperties properties, javax.servlet.ServletContext servletContext) INTERNAL -
Method Summary
Modifier and TypeMethodDescriptionprotected org.dom4j.io.SAXReadergetSaxReader(SAXParser saxParser) protected voidinitPool()voidorg.dom4j.DocumentreadDocument(File file) org.dom4j.DocumentreadDocument(InputStream stream) org.dom4j.DocumentreadDocument(Reader reader) org.dom4j.DocumentreadDocument(String xmlString) voidshutdown()Shuts down the pool, unregisters JMX.voidvoidwalkAttributes(org.dom4j.Element element, Dom4j.ElementAttributeVisitor visitor) voidwalkAttributesRecursive(org.dom4j.Element element, Dom4j.ElementAttributeVisitor visitor) protected <T> TwithSAXParserFromPool(Function<SAXParser, T> action) writeDocument(org.dom4j.Document doc, boolean prettyPrint) voidwriteDocument(org.dom4j.Document doc, boolean prettyPrint, OutputStream stream) voidwriteDocument(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
-