Exemple #1
0
  /**
   * Prevede XML retezec na DOM dokument.
   *
   * @param xml retezec obsahujici XML nebo HTML
   * @return DOM dokument
   * @throws ProblemException pokud dojde k chybe pri prevodu
   */
  public static Document createDOMDocument(String xml) throws ProblemException {

    if (Checker.isBlank(xml)) return null;

    try {
      InputSource is = new InputSource(new StringReader(xml));
      return getDocBuilder().parse(is);

    } catch (IOException | SAXException e) {
      logger.error(e.toString(), e);
      throw new ProblemException(e, XmlProblem.PARSING, e.toString());
    }
  }