Package org.apache.ivy.util
Class XMLHelper
- java.lang.Object
-
- org.apache.ivy.util.XMLHelper
-
public abstract class XMLHelper extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
XMLHelper.ExternalResources
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ALLOW_DOCTYPE_PROCESSING
static java.lang.String
EXTERNAL_RESOURCES
-
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 javax.xml.parsers.DocumentBuilder
getDocBuilder(org.xml.sax.EntityResolver entityResolver, boolean allowXmlDoctypeProcessing, XMLHelper.ExternalResources externalResources)
static javax.xml.transform.Transformer
getTransformer(javax.xml.transform.Source source)
static javax.xml.transform.sax.TransformerHandler
getTransformerHandler()
static boolean
isXmlDoctypeProcessingAllowed()
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.io.InputStream xmlStream, java.net.URL schema, org.xml.sax.helpers.DefaultHandler handler, org.xml.sax.ext.LexicalHandler lHandler, XMLHelper.ExternalResources externalResources)
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(java.net.URL xmlURL, java.net.URL schema, org.xml.sax.helpers.DefaultHandler handler, org.xml.sax.ext.LexicalHandler lHandler, XMLHelper.ExternalResources externalResources)
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 void
parse(org.xml.sax.InputSource xmlStream, java.net.URL schema, org.xml.sax.helpers.DefaultHandler handler, org.xml.sax.ext.LexicalHandler lHandler, XMLHelper.ExternalResources externalResources)
static org.w3c.dom.Document
parseToDom(org.xml.sax.InputSource source, org.xml.sax.EntityResolver entityResolver)
static org.w3c.dom.Document
parseToDom(org.xml.sax.InputSource source, org.xml.sax.EntityResolver entityResolver, boolean allowXmlDoctypeProcessing, XMLHelper.ExternalResources externalResources)
static java.lang.String
toSystemId(java.net.URL url)
Convert an URL to a valid systemId according to RFC 2396.
-
-
-
Field Detail
-
ALLOW_DOCTYPE_PROCESSING
public static final java.lang.String ALLOW_DOCTYPE_PROCESSING
- See Also:
- Constant Field Values
-
EXTERNAL_RESOURCES
public static final java.lang.String EXTERNAL_RESOURCES
- See Also:
- Constant Field Values
-
-
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.net.URL xmlURL, java.net.URL schema, org.xml.sax.helpers.DefaultHandler handler, org.xml.sax.ext.LexicalHandler lHandler, XMLHelper.ExternalResources externalResources) 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(java.io.InputStream xmlStream, java.net.URL schema, org.xml.sax.helpers.DefaultHandler handler, org.xml.sax.ext.LexicalHandler lHandler, XMLHelper.ExternalResources externalResources) 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
-
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, XMLHelper.ExternalResources externalResources) 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
-
parseToDom
public static org.w3c.dom.Document parseToDom(org.xml.sax.InputSource source, org.xml.sax.EntityResolver entityResolver, boolean allowXmlDoctypeProcessing, XMLHelper.ExternalResources externalResources) 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)
-
getDocBuilder
public static javax.xml.parsers.DocumentBuilder getDocBuilder(org.xml.sax.EntityResolver entityResolver, boolean allowXmlDoctypeProcessing, XMLHelper.ExternalResources externalResources)
-
getTransformer
public static javax.xml.transform.Transformer getTransformer(javax.xml.transform.Source source) throws javax.xml.transform.TransformerConfigurationException
- Throws:
javax.xml.transform.TransformerConfigurationException
-
getTransformerHandler
public static javax.xml.transform.sax.TransformerHandler getTransformerHandler() throws javax.xml.transform.TransformerConfigurationException
- Throws:
javax.xml.transform.TransformerConfigurationException
-
isXmlDoctypeProcessingAllowed
public static boolean isXmlDoctypeProcessingAllowed()
-
-