View Javadoc
1   package com.atlassian.plugin.validation;
2   
3   import org.dom4j.Document;
4   import org.dom4j.DocumentException;
5   import org.dom4j.io.SAXReader;
6   
7   import java.io.InputStream;
8   
9   /**
10   * @since 3.0.0
11   */
12  abstract class Dom4jUtils {
13      private Dom4jUtils() {
14      }
15  
16      public static Document readDocument(final InputStream input) {
17          try {
18              return getSaxReader().read(input);
19          } catch (DocumentException e) {
20              throw new RuntimeException(e);
21          }
22      }
23  
24      private static SAXReader getSaxReader() {
25          final SAXReader reader = new SAXReader();
26          reader.setMergeAdjacentText(true);
27          return reader;
28      }
29  }