Package com.norconex.commons.lang.xml

# Class XmlUtil

java.lang.Object
com.norconex.commons.lang.xml.XmlUtil

public final class XmlUtil extends Object

Utility XML-related methods. When applicable:

- Uses XML Schema version 1.1.
- Addresses XML security vulnerabilities (XXE).
- Wraps checked exceptions in a runtime `XmlException`.

Since:
  2.0.0

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `W3C_XML_SCHEMA_NS_URI_1_1`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static DocumentBuilderFactory`
  `createDocumentBuilderFactory()`
  `static SAXParserFactory`
  `createSaxParserFactory()`
  `static SchemaFactory`
  `createSchemaFactory()`
  `static Validator`
  `createSchemaValidator(Schema schema)`
  `static XMLEventReader`
  `createXMLEventReader(Object obj)`
  Creates an `XMLEventReader` from the supplied object representing XML.
  `static XMLInputFactory`
  `createXMLInputFactory()`
  `static XMLReader`
  `createXMLReader()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### W3C_XML_SCHEMA_NS_URI_1_1

    public static final String W3C_XML_SCHEMA_NS_URI_1_1
    See Also:
      - Constant Field Values

- ## Method Details

  - ### createSchemaValidator

    public static Validator createSchemaValidator(Schema schema)

  - ### createSchemaFactory

    public static SchemaFactory createSchemaFactory()

  - ### createXMLReader

    public static XMLReader createXMLReader()

  - ### createDocumentBuilderFactory

    public static DocumentBuilderFactory createDocumentBuilderFactory()

  - ### createSaxParserFactory

    public static SAXParserFactory createSaxParserFactory()

  - ### createXMLInputFactory

    public static XMLInputFactory createXMLInputFactory()

  - ### createXMLEventReader

    public static XMLEventReader createXMLEventReader(Object obj)

    Creates an `XMLEventReader` from the supplied object representing XML. Supported types are:

    - `Path`
    - `File`
    - `Node`
    - `Xml`
    - `String`
    - `InputStream`
    - `Reader`
    - `XMLEventReader` (returns itself)
    Parameters:
      `obj` - the object to read
    Returns:
      XML event reader