org.apache.ivy.util

Class XMLHelper

public abstract class XMLHelper extends Object

Method Summary
static booleancanUseSchemaValidation()
static Stringescape(String text)
Escapes invalid XML characters in the given character data using XML entities.
static DocumentBuildergetDocBuilder(EntityResolver entityResolver)
static voidparse(URL xmlURL, URL schema, DefaultHandler handler)
static voidparse(URL xmlURL, URL schema, DefaultHandler handler, LexicalHandler lHandler)
static voidparse(InputStream xmlStream, URL schema, DefaultHandler handler, LexicalHandler lHandler)
static voidparse(InputSource xmlStream, URL schema, DefaultHandler handler, LexicalHandler lHandler)
static DocumentparseToDom(InputStream stream, Resource res, EntityResolver entityResolver)

Method Detail

canUseSchemaValidation

public static boolean canUseSchemaValidation()

escape

public static String escape(String text)
Escapes invalid XML characters in the given character data using XML entities. For the moment, only the following characters are being escaped: (<), (&), (') and ("). Remark: we don't escape the (>) character to keep the readability of the configuration mapping! The XML spec only requires that the (&) and (<) characters are being escaped inside character data.

Parameters: text the character data to escape

Returns: the escaped character data

getDocBuilder

public static DocumentBuilder getDocBuilder(EntityResolver entityResolver)

parse

public static void parse(URL xmlURL, URL schema, DefaultHandler handler)

parse

public static void parse(URL xmlURL, URL schema, DefaultHandler handler, LexicalHandler lHandler)

parse

public static void parse(InputStream xmlStream, URL schema, DefaultHandler handler, LexicalHandler lHandler)

parse

public static void parse(InputSource xmlStream, URL schema, DefaultHandler handler, LexicalHandler lHandler)

parseToDom

public static Document parseToDom(InputStream stream, Resource res, EntityResolver entityResolver)