@@ -107,12 +107,12 @@ public static QName createQName(String localName) {
107107 * XPath <code>XPath</code> instance using the singleton {@link
108108 * DocumentFactory}.
109109 * </p>
110- *
110+ *
111111 * @param xpathExpression
112112 * is the XPath expression to create
113- *
113+ *
114114 * @return a new <code>XPath</code> instance
115- *
115+ *
116116 * @throws InvalidXPathException
117117 * if the XPath expression is invalid
118118 */
@@ -127,14 +127,14 @@ public static XPath createXPath(String xpathExpression)
127127 * XPath <code>XPath</code> instance using the singleton {@link
128128 * DocumentFactory}.
129129 * </p>
130- *
130+ *
131131 * @param xpathExpression
132132 * is the XPath expression to create
133133 * @param context
134134 * is the variable context to use when evaluating the XPath
135- *
135+ *
136136 * @return a new <code>XPath</code> instance
137- *
137+ *
138138 * @throws InvalidXPathException
139139 * if the XPath expression is invalid
140140 */
@@ -150,10 +150,10 @@ public static XPath createXPath(String xpathExpression,
150150 * filter expressions occur within XPath expressions such as
151151 * <code>self::node()[ filterExpression ]</code>
152152 * </p>
153- *
153+ *
154154 * @param xpathFilterExpression
155155 * is the XPath filter expression to create
156- *
156+ *
157157 * @return a new <code>NodeFilter</code> instance
158158 */
159159 public static NodeFilter createXPathFilter (String xpathFilterExpression ) {
@@ -166,10 +166,10 @@ public static NodeFilter createXPathFilter(String xpathFilterExpression) {
166166 * an XSLT style {@link Pattern}instance which can then be used in an XSLT
167167 * processing model.
168168 * </p>
169- *
169+ *
170170 * @param xpathPattern
171171 * is the XPath pattern expression to create
172- *
172+ *
173173 * @return a new <code>Pattern</code> instance
174174 */
175175 public static Pattern createPattern (String xpathPattern ) {
@@ -182,12 +182,12 @@ public static Pattern createPattern(String xpathPattern) {
182182 * {@link List}of {@link Node}instances appending all the results together
183183 * into a single list.
184184 * </p>
185- *
185+ *
186186 * @param xpathFilterExpression
187187 * is the XPath filter expression to evaluate
188188 * @param nodes
189189 * is the list of nodes on which to evalute the XPath
190- *
190+ *
191191 * @return the results of all the XPath evaluations as a single list
192192 */
193193 public static List <Node > selectNodes (String xpathFilterExpression , List <Node > nodes ) {
@@ -202,12 +202,12 @@ public static List<Node> selectNodes(String xpathFilterExpression, List<Node> no
202202 * {@link List}of {@link Node}instances appending all the results together
203203 * into a single list.
204204 * </p>
205- *
205+ *
206206 * @param xpathFilterExpression
207207 * is the XPath filter expression to evaluate
208208 * @param node
209209 * is the Node on which to evalute the XPath
210- *
210+ *
211211 * @return the results of all the XPath evaluations as a single list
212212 */
213213 public static List <Node > selectNodes (String xpathFilterExpression , Node node ) {
@@ -221,7 +221,7 @@ public static List<Node> selectNodes(String xpathFilterExpression, Node node) {
221221 * <code>sort</code> sorts the given List of Nodes using an XPath
222222 * expression as a {@link java.util.Comparator}.
223223 * </p>
224- *
224+ *
225225 * @param list
226226 * is the list of Nodes to sort
227227 * @param xpathExpression
@@ -238,7 +238,7 @@ public static void sort(List<Node> list, String xpathExpression) {
238238 * expression as a {@link java.util.Comparator}and optionally removing
239239 * duplicates.
240240 * </p>
241- *
241+ *
242242 * @param list
243243 * is the list of Nodes to sort
244244 * @param expression
@@ -259,24 +259,17 @@ public static void sort(List<Node> list, String expression, boolean distinct) {
259259 * </p>
260260 *
261261 * Loading external DTD and entities is disabled (if it is possible) for security reasons.
262- *
262+ *
263263 * @param text
264264 * the XML text to be parsed
265- *
265+ *
266266 * @return a newly parsed Document
267- *
267+ *
268268 * @throws DocumentException
269269 * if the document could not be parsed
270270 */
271271 public static Document parseText (String text ) throws DocumentException {
272- SAXReader reader = new SAXReader ();
273- try {
274- reader .setFeature ("http://apache.org/xml/features/nonvalidating/load-external-dtd" , false );
275- reader .setFeature ("http://xml.org/sax/features/external-general-entities" , false );
276- reader .setFeature ("http://xml.org/sax/features/external-parameter-entities" , false );
277- } catch (SAXException e ) {
278- //Parse with external resources downloading allowed.
279- }
272+ SAXReader reader = SAXReader .createDefault ();
280273
281274 String encoding = getEncoding (text );
282275
@@ -330,14 +323,14 @@ private static String getEncoding(String text) {
330323 * get the first child <a> element, which would be created if it did
331324 * not exist, then the next child <b> and so on until finally a
332325 * <c> element is returned.
333- *
326+ *
334327 * @param source
335328 * is the Element or Document to start navigating from
336329 * @param path
337330 * is a simple path expression, seperated by '/' which denotes
338331 * the path from the source to the resulting element such as
339332 * a/b/c
340- *
333+ *
341334 * @return the first Element on the given path which either already existed
342335 * on the path or were created by this method.
343336 */
@@ -386,24 +379,24 @@ public static Element makeElement(Branch source, String path) {
386379 * Redistribution and use of this software and associated documentation
387380 * ("Software"), with or without modification, are permitted provided that the
388381 * following conditions are met:
389- *
382+ *
390383 * 1. Redistributions of source code must retain copyright statements and
391384 * notices. Redistributions must also contain a copy of this document.
392- *
385+ *
393386 * 2. Redistributions in binary form must reproduce the above copyright notice,
394387 * this list of conditions and the following disclaimer in the documentation
395388 * and/or other materials provided with the distribution.
396- *
389+ *
397390 * 3. The name "DOM4J" must not be used to endorse or promote products derived
398391 * from this Software without prior written permission of MetaStuff, Ltd. For
399392 * written permission, please contact dom4j-info@metastuff.com.
400- *
393+ *
401394 * 4. Products derived from this Software may not be called "DOM4J" nor may
402395 * "DOM4J" appear in their names without prior written permission of MetaStuff,
403396 * Ltd. DOM4J is a registered trademark of MetaStuff, Ltd.
404- *
397+ *
405398 * 5. Due credit should be given to the DOM4J Project - http://www.dom4j.org
406- *
399+ *
407400 * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS ``AS IS'' AND
408401 * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
409402 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -415,6 +408,6 @@ public static Element makeElement(Branch source, String path) {
415408 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
416409 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
417410 * POSSIBILITY OF SUCH DAMAGE.
418- *
411+ *
419412 * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
420413 */
0 commit comments