Package org.apache.ivy.util
Class XMLHelper
- java.lang.Object
-
- org.apache.ivy.util.XMLHelper
-
public abstract class XMLHelper extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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(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 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(org.xml.sax.InputSource xmlStream, java.net.URL schema, org.xml.sax.helpers.DefaultHandler handler, org.xml.sax.ext.LexicalHandler lHandler, boolean loadExternalDtds)
static org.w3c.dom.Document
parseToDom(org.xml.sax.InputSource source, org.xml.sax.EntityResolver entityResolver)
static java.lang.String
toSystemId(java.net.URL url)
Convert an URL to a valid systemId according to RFC 2396.
-
-
-
Method Detail
-
toSystemId
public static java.lang.String toSystemId(java.net.URL url)
Convert an URL to a valid systemId according to RFC 2396.- Parameters:
url
- URL- Returns:
- String
-
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
-
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, boolean loadExternalDtds) 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(org.xml.sax.InputSource source, 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)
-
-