package org.lodder.subtools.sublibrary.data;

import java.io.IOException;

import javax.xml.parsers.ParserConfigurationException;

import org.lodder.subtools.sublibrary.Manager;
import org.lodder.subtools.sublibrary.ManagerException;
import org.lodder.subtools.sublibrary.ManagerSetupException;
import org.lodder.subtools.sublibrary.logging.Logger;
import org.lodder.subtools.sublibrary.xml.XMLHelper;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;

public class XmlHTTP {

  private Manager manager;

  public XmlHTTP(Manager manager) {
    this.manager = manager;
  }

  public Document getXML(String url) throws ParserConfigurationException,
      IOException, ManagerSetupException, ManagerException {
    Logger.instance.trace("XmlHTTPAPI", "getXML", "");
    return XMLHelper.getDocument(manager.getContentStream(url, null, false));
  }

  public Document getXMLDisk(String url) throws ManagerSetupException, ManagerException, ParserConfigurationException, SAXException, IOException {
    Logger.instance.trace("XmlHTTPAPI", "getXMLDisk", "");
    String content = manager.getContent(url, null, true);
    // Bierdopje issue! OElig
    content = content.replaceAll("&OElig;", "Œ");
    // Bierdopje issue! &Pi;
    content = content.replaceAll("&Pi;", "\u003A0").replaceAll("&pi;", "\u003A0");
    // BIerdopje issue! &hellip;
    content = content.replaceAll("&hellip;", "...");
    return XMLHelper.getDocument(content);
  }

  public void removeCacheEntry(String url) throws ManagerSetupException {
    manager.removeCacheObject(url);
  }

}

@@ -339,20 +339,19 @@
 ary.
-logging.Logg
+xml.XMLHelp
 er;%0D
@@ -366,48 +366,53 @@
 org.
-lodder.subtools.sublibrary.xml.XMLHelper
+slf4j.Logger;%0D%0Aimport org.slf4j.LoggerFactory
 ;%0D%0Ai
@@ -502,16 +502,98 @@
 TP %7B%0D%0A%0D%0A
+  private static final Logger LOGGER = LoggerFactory.getLogger(XmlHTTP.class);%0D%0A%0D%0A
   privat
@@ -764,15 +764,8 @@
 ion,
-%0D%0A     
  IOE
@@ -765,32 +765,39 @@
 on, IOException,
+%0D%0A     
  ManagerSetupExc
@@ -833,55 +833,36 @@
    L
-ogger.instance.trace(%22XmlHTTPAPI%22, %22getXML%22, %22%22
+OGGER.trace(%22getXML %7B%7D%22, url
 );%0D%0A
@@ -1035,16 +1035,23 @@
 ception,
+%0D%0A     
  ParserC
@@ -1111,43 +1111,20 @@
    L
-ogger.instance.trace(%22XmlHTTPAPI%22, 
+OGGER.trace(
 %22get
@@ -1134,13 +1134,17 @@
 Disk
-%22, %22%22
+ %7B%7D%22, url
 );%0D%0A
@@ -1608,24 +1608,71 @@
 xception %7B%0D%0A
+    LOGGER.trace(%22removeCacheEntry %7B%7D%22, url);%0D%0A
     manager.

Convert XmlHTTP from old logger to new LOGGER slf4j