org.apache.wiki.util
Class XmlUtil

java.lang.Object
  extended by org.apache.wiki.util.XmlUtil

public final class XmlUtil
extends Object

Utility class to parse XML files.

This uses JDOM2 as its backing implementation.

Since:
2.10

Method Summary
static List<org.jdom2.Element> parse(InputStream xmlStream, String requestedNodes)
          Parses the given stream and returns the requested nodes.
static List<org.jdom2.Element> parse(String xml, String requestedNodes)
          Parses the given XML file and returns the requested nodes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

parse

public static List<org.jdom2.Element> parse(String xml,
                                            String requestedNodes)
Parses the given XML file and returns the requested nodes. If there's an error accessing or parsing the file, an empty list is returned.

Parameters:
xml - file to parse; matches all resources from classpath, filters repeated items.
requestedNodes - requestd nodes on the xml file
Returns:
the requested nodes of the XML file.

parse

public static List<org.jdom2.Element> parse(InputStream xmlStream,
                                            String requestedNodes)
Parses the given stream and returns the requested nodes. If there's an error accessing or parsing the stream, an empty list is returned.

Parameters:
xmlStream - stream to parse.
requestedNodes - requestd nodes on the xml stream.
Returns:
the requested nodes of the XML stream.


Copyright © {inceptionYear}-2014 The Apache Software Foundation. All rights reserved.