org.apache.ivy.util
Class XMLHelper
java.lang.Object
org.apache.ivy.util.XMLHelper
public abstract class XMLHelper
- extends java.lang.Object
Method Summary |
static boolean |
canUseSchemaValidation()
|
static java.lang.String |
escape(java.lang.String text)
Escapes invalid XML characters in the given character data using XML entities. |
static javax.xml.parsers.DocumentBuilder |
getDocBuilder(org.xml.sax.EntityResolver entityResolver)
|
static void |
parse(org.xml.sax.InputSource xmlStream,
java.net.URL schema,
org.xml.sax.helpers.DefaultHandler handler,
org.xml.sax.ext.LexicalHandler lHandler)
|
static void |
parse(java.io.InputStream xmlStream,
java.net.URL schema,
org.xml.sax.helpers.DefaultHandler handler,
org.xml.sax.ext.LexicalHandler lHandler)
|
static void |
parse(java.net.URL xmlURL,
java.net.URL schema,
org.xml.sax.helpers.DefaultHandler handler)
|
static void |
parse(java.net.URL xmlURL,
java.net.URL schema,
org.xml.sax.helpers.DefaultHandler handler,
org.xml.sax.ext.LexicalHandler lHandler)
|
static org.w3c.dom.Document |
parseToDom(java.io.InputStream stream,
Resource res,
org.xml.sax.EntityResolver entityResolver)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
parse
public static void parse(java.net.URL xmlURL,
java.net.URL schema,
org.xml.sax.helpers.DefaultHandler handler)
throws org.xml.sax.SAXException,
java.io.IOException,
javax.xml.parsers.ParserConfigurationException
- Throws:
org.xml.sax.SAXException
java.io.IOException
javax.xml.parsers.ParserConfigurationException
parse
public static void parse(java.net.URL xmlURL,
java.net.URL schema,
org.xml.sax.helpers.DefaultHandler handler,
org.xml.sax.ext.LexicalHandler lHandler)
throws org.xml.sax.SAXException,
java.io.IOException,
javax.xml.parsers.ParserConfigurationException
- Throws:
org.xml.sax.SAXException
java.io.IOException
javax.xml.parsers.ParserConfigurationException
parse
public static void parse(java.io.InputStream xmlStream,
java.net.URL schema,
org.xml.sax.helpers.DefaultHandler handler,
org.xml.sax.ext.LexicalHandler lHandler)
throws org.xml.sax.SAXException,
java.io.IOException,
javax.xml.parsers.ParserConfigurationException
- Throws:
org.xml.sax.SAXException
java.io.IOException
javax.xml.parsers.ParserConfigurationException
parse
public static void parse(org.xml.sax.InputSource xmlStream,
java.net.URL schema,
org.xml.sax.helpers.DefaultHandler handler,
org.xml.sax.ext.LexicalHandler lHandler)
throws org.xml.sax.SAXException,
java.io.IOException,
javax.xml.parsers.ParserConfigurationException
- Throws:
org.xml.sax.SAXException
java.io.IOException
javax.xml.parsers.ParserConfigurationException
canUseSchemaValidation
public static boolean canUseSchemaValidation()
escape
public static java.lang.String escape(java.lang.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
parseToDom
public static org.w3c.dom.Document parseToDom(java.io.InputStream stream,
Resource res,
org.xml.sax.EntityResolver entityResolver)
throws java.io.IOException,
org.xml.sax.SAXException
- Throws:
java.io.IOException
org.xml.sax.SAXException
getDocBuilder
public static javax.xml.parsers.DocumentBuilder getDocBuilder(org.xml.sax.EntityResolver entityResolver)