Package org.apache.ivy.util
Class XMLHelper
java.lang.Object
org.apache.ivy.util.XMLHelper
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumprivate static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprivate static final InputSourcestatic final String(package private) static final String(package private) static final String(package private) static final String(package private) static final Stringprivate static final Stringprivate static final String(package private) static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanprivate static voidconfigureSafeFeatures(DocumentBuilderFactory factory, boolean allowXmlDoctypeProcessing, XMLHelper.ExternalResources externalResources) private static voidconfigureSafeFeatures(SAXParserFactory factory, boolean allowXmlDoctypeProcessing, XMLHelper.ExternalResources externalResources) private static voidconfigureSafeFeatures(TransformerFactory factory) static StringEscapes invalid XML characters in the given character data using XML entities.static DocumentBuildergetDocBuilder(EntityResolver entityResolver) static DocumentBuildergetDocBuilder(EntityResolver entityResolver, boolean allowXmlDoctypeProcessing, XMLHelper.ExternalResources externalResources) static TransformergetTransformer(Source source) private static SAXTransformerFactorystatic TransformerHandlerprivate static booleanisAttributeSupported(TransformerFactory factory, String attribute) private static booleanisFeatureSupported(DocumentBuilderFactory factory, String feature) private static booleanisFeatureSupported(SAXParserFactory factory, String feature) static booleanprivate static SAXParsernewSAXParser(URL schema, InputStream schemaStream, boolean allowXmlDoctypeProcessing, XMLHelper.ExternalResources externalResources) static voidparse(InputStream xmlStream, URL schema, DefaultHandler handler, LexicalHandler lHandler) static voidparse(InputStream xmlStream, URL schema, DefaultHandler handler, LexicalHandler lHandler, XMLHelper.ExternalResources externalResources) static voidparse(URL xmlURL, URL schema, DefaultHandler handler) static voidparse(URL xmlURL, URL schema, DefaultHandler handler, LexicalHandler lHandler) static voidparse(URL xmlURL, URL schema, DefaultHandler handler, LexicalHandler lHandler, XMLHelper.ExternalResources externalResources) static voidparse(InputSource xmlStream, URL schema, DefaultHandler handler, LexicalHandler lHandler) static voidparse(InputSource xmlStream, URL schema, DefaultHandler handler, LexicalHandler lHandler, boolean loadExternalDtds) static voidparse(InputSource xmlStream, URL schema, DefaultHandler handler, LexicalHandler lHandler, XMLHelper.ExternalResources externalResources) static DocumentparseToDom(InputSource source, EntityResolver entityResolver) static DocumentparseToDom(InputSource source, EntityResolver entityResolver, boolean allowXmlDoctypeProcessing, XMLHelper.ExternalResources externalResources) static StringtoSystemId(URL url) Convert an URL to a valid systemId according to RFC 2396.private static booleantrySetAttribute(TransformerFactory factory, String attribute, String val) private static booleantrySetFeature(DocumentBuilderFactory factory, String feature, boolean val) private static booleantrySetFeature(SAXParserFactory factory, String feature, boolean val)
-
Field Details
-
JAXP_SCHEMA_LANGUAGE
- See Also:
-
JAXP_SCHEMA_SOURCE
- See Also:
-
XERCES_LOAD_EXTERNAL_DTD
- See Also:
-
XML_NAMESPACE_PREFIXES
- See Also:
-
W3C_XML_SCHEMA
- See Also:
-
XML_ACCESS_EXTERNAL_SCHEMA
- See Also:
-
XML_ACCESS_EXTERNAL_DTD
- See Also:
-
ALLOW_DOCTYPE_PROCESSING
- See Also:
-
EXTERNAL_RESOURCES
- See Also:
-
EMPTY_INPUT_SOURCE
-
-
Constructor Details
-
XMLHelper
private XMLHelper()
-
-
Method Details
-
newSAXParser
private static SAXParser newSAXParser(URL schema, InputStream schemaStream, boolean allowXmlDoctypeProcessing, XMLHelper.ExternalResources externalResources) throws ParserConfigurationException, SAXException -
toSystemId
Convert an URL to a valid systemId according to RFC 2396.- Parameters:
url- URL- Returns:
- String
-
parse
public static void parse(URL xmlURL, URL schema, DefaultHandler handler) throws SAXException, IOException, ParserConfigurationException -
parse
public static void parse(URL xmlURL, URL schema, DefaultHandler handler, LexicalHandler lHandler) throws SAXException, IOException, ParserConfigurationException -
parse
public static void parse(URL xmlURL, URL schema, DefaultHandler handler, LexicalHandler lHandler, XMLHelper.ExternalResources externalResources) throws SAXException, IOException, ParserConfigurationException -
parse
public static void parse(InputStream xmlStream, URL schema, DefaultHandler handler, LexicalHandler lHandler) throws SAXException, IOException, ParserConfigurationException -
parse
public static void parse(InputStream xmlStream, URL schema, DefaultHandler handler, LexicalHandler lHandler, XMLHelper.ExternalResources externalResources) throws SAXException, IOException, ParserConfigurationException -
parse
public static void parse(InputSource xmlStream, URL schema, DefaultHandler handler, LexicalHandler lHandler) throws SAXException, IOException, ParserConfigurationException -
parse
public static void parse(InputSource xmlStream, URL schema, DefaultHandler handler, LexicalHandler lHandler, boolean loadExternalDtds) throws SAXException, IOException, ParserConfigurationException -
parse
public static void parse(InputSource xmlStream, URL schema, DefaultHandler handler, LexicalHandler lHandler, XMLHelper.ExternalResources externalResources) throws SAXException, IOException, ParserConfigurationException -
canUseSchemaValidation
public static boolean canUseSchemaValidation() -
escape
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 Document parseToDom(InputSource source, EntityResolver entityResolver) throws IOException, SAXException - Throws:
IOExceptionSAXException
-
parseToDom
public static Document parseToDom(InputSource source, EntityResolver entityResolver, boolean allowXmlDoctypeProcessing, XMLHelper.ExternalResources externalResources) throws IOException, SAXException - Throws:
IOExceptionSAXException
-
getDocBuilder
-
getDocBuilder
public static DocumentBuilder getDocBuilder(EntityResolver entityResolver, boolean allowXmlDoctypeProcessing, XMLHelper.ExternalResources externalResources) -
getTransformer
-
getTransformerHandler
-
isXmlDoctypeProcessingAllowed
public static boolean isXmlDoctypeProcessingAllowed() -
getTransformerFactory
-
configureSafeFeatures
private static void configureSafeFeatures(DocumentBuilderFactory factory, boolean allowXmlDoctypeProcessing, XMLHelper.ExternalResources externalResources) -
configureSafeFeatures
private static void configureSafeFeatures(SAXParserFactory factory, boolean allowXmlDoctypeProcessing, XMLHelper.ExternalResources externalResources) -
configureSafeFeatures
-
isFeatureSupported
-
isFeatureSupported
-
isAttributeSupported
-
trySetFeature
-
trySetFeature
-
trySetAttribute
-