public final class XmlUtils extends java.lang.Object
| Modifier | Constructor and Description |
|---|---|
private |
XmlUtils() |
| Modifier and Type | Method and Description |
|---|---|
static org.w3c.dom.Element |
getFirstChildElement(org.w3c.dom.Node parent)
Get the first child element
|
static javax.xml.parsers.DocumentBuilder |
newSafeDOMBuilder()
Returns a new secure DOM builder, supporting XML namespaces.
|
static javax.xml.parsers.SAXParser |
newSafeSAXParser()
Returns a new secure SAX parser, supporting XML namespaces.
|
static javax.xml.transform.TransformerFactory |
newSafeTransformerFactory()
Returns a new secure
TransformerFactory. |
static javax.xml.validation.Validator |
newSafeValidator(javax.xml.validation.Schema schema)
Returns a new secure
Validator. |
static javax.xml.stream.XMLInputFactory |
newSafeXMLInputFactory()
Returns a new secure
XMLInputFactory. |
static javax.xml.validation.SchemaFactory |
newXmlSchemaFactory()
Returns the W3C XML Schema factory implementation.
|
static org.w3c.dom.Document |
parseSafeDOM(java.io.InputStream is)
Parse the content given
InputStream as XML. |
static void |
parseSafeSAX(org.xml.sax.InputSource is,
org.xml.sax.helpers.DefaultHandler dh)
Parse the content given
InputSource as XML using the specified DefaultHandler. |
private XmlUtils()
public static javax.xml.validation.SchemaFactory newXmlSchemaFactory()
public static javax.xml.parsers.DocumentBuilder newSafeDOMBuilder() throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.ParserConfigurationException - if a parser cannot be created which satisfies the requested configuration.public static org.w3c.dom.Document parseSafeDOM(java.io.InputStream is) throws javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException
InputStream as XML.
This method uses a secure DOM builder, supporting XML namespaces.is - The InputStream containing the content to be parsed.javax.xml.parsers.ParserConfigurationException - if a parser cannot be created which satisfies the requested configuration.java.io.IOException - if any IO errors occur.org.xml.sax.SAXException - for SAX errors.public static javax.xml.parsers.SAXParser newSafeSAXParser() throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException - if a parser cannot be created which satisfies the requested configuration.org.xml.sax.SAXException - for SAX errors.public static void parseSafeSAX(org.xml.sax.InputSource is, org.xml.sax.helpers.DefaultHandler dh) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException, java.io.IOException
InputSource as XML using the specified DefaultHandler.
This method uses a secure SAX parser, supporting XML namespaces.is - The InputSource containing the content to be parsed.dh - The SAX DefaultHandler to use.javax.xml.parsers.ParserConfigurationException - if a parser cannot be created which satisfies the requested configuration.org.xml.sax.SAXException - for SAX errors.java.io.IOException - if any IO errors occur.public static javax.xml.stream.XMLInputFactory newSafeXMLInputFactory()
XMLInputFactory.XMLInputFactory, for which external entities are not loadedpublic static javax.xml.transform.TransformerFactory newSafeTransformerFactory() throws javax.xml.transform.TransformerConfigurationException
TransformerFactory.TransformerFactoryjavax.xml.transform.TransformerConfigurationException - if the factory or the Transformers or Templates it creates cannot support this feature.public static javax.xml.validation.Validator newSafeValidator(javax.xml.validation.Schema schema)
Validator.schema - XML schemaValidatorpublic static org.w3c.dom.Element getFirstChildElement(org.w3c.dom.Node parent)
parent - parent node