Class JRXmlUtils

java.lang.Object
net.sf.jasperreports.engine.util.JRXmlUtils

public final class JRXmlUtils extends Object
XML parsing utilities.
Author:
Lucian Chirita (lucianc@users.sourceforge.net)
  • Field Details

  • Method Details

    • parse

      public static Document parse(InputSource is) throws JRException
      Throws:
      JRException
    • parse

      public static Document parse(InputSource is, boolean isNamespaceAware) throws JRException
      Parses an input source into a document.
      Parameters:
      is - the input source
      Returns:
      the parsed document
      Throws:
      JRException
    • parse

      public static Document parse(String uri) throws JRException
      Throws:
      JRException
    • parse

      public static Document parse(String uri, boolean isNamespaceAware) throws JRException
      Parses a document specified by an URI.
      Parameters:
      uri - the URI
      Returns:
      the parsed document
      Throws:
      JRException
    • parse

      public static Document parse(File file) throws JRException
      Throws:
      JRException
    • parse

      public static Document parse(File file, boolean isNamespaceAware) throws JRException
      Parses a file into a document.
      Parameters:
      file - the XML file
      Returns:
      the document
      Throws:
      JRException
    • parse

      public static Document parse(InputStream is) throws JRException
      Throws:
      JRException
    • parse

      public static Document parse(InputStream is, boolean isNamespaceAware) throws JRException
      Parses an input stream into a XML document.
      Parameters:
      is - the input stream
      Returns:
      the document
      Throws:
      JRException
    • parse

      public static Document parse(URL url) throws JRException
      Throws:
      JRException
    • parse

      public static Document parse(URL url, boolean isNamespaceAware) throws JRException
      Parses an URL stream as a XML document.
      Parameters:
      url - the URL
      Returns:
      the document
      Throws:
      JRException
    • createDocumentBuilder

      public static DocumentBuilder createDocumentBuilder() throws JRException
      Throws:
      JRException
    • createDocumentBuilder

      public static DocumentBuilder createDocumentBuilder(boolean isNamespaceAware) throws JRException
      Creates a XML document builder.
      Returns:
      a XML document builder
      Throws:
      JRException
    • allowDoctype

      protected static boolean allowDoctype()
    • createDocument

      public static Document createDocument(Node sourceNode) throws JRException
      Throws:
      JRException
    • createDocument

      public static Document createDocument(Node sourceNode, boolean isNamespaceAware) throws JRException
      Creates a document having a node as root.
      Parameters:
      sourceNode - the node
      Returns:
      a document having the specified node as root
      Throws:
      JRException
    • createTransformerFactory

      public static TransformerFactory createTransformerFactory()
      Creates a transformer factory with secure processing enabled and access to external DTDs and stylesheets disabled.

      Settings not supported by the transformer implementation are skipped (with a log message), as the factory is still usable for serializing in-memory DOM trees.

      Returns:
      a transformer factory