# This is an adaptation of a script i found on xmlsoft.org
#                                Jon Svendsen
# 2003-09-13: remove the backwards compat options (Arwed v. Merkatz)
unregister_docbook() {(
  VER=$1
  xmlcatalog --noout --del \
      "-//OASIS//ELEMENTS DocBook XML Information Pool V$VER//EN" \
      $CATALOG
  xmlcatalog --noout --del \
      "-//OASIS//DTD DocBook XML V$VER//EN" \
      $CATALOG
  xmlcatalog --noout --del \
      "-//OASIS//ENTITIES DocBook XML Character Entities V$VER//EN" \
      $CATALOG
  xmlcatalog --noout --del \
      "-//OASIS//ENTITIES DocBook XML Notations V$VER//EN" \
      $CATALOG
  xmlcatalog --noout --del \
      "-//OASIS//ENTITIES DocBook XML Additional General Entities V$VER//EN" \
      $CATALOG
  xmlcatalog --noout --del \
      "-//OASIS//ELEMENTS DocBook XML Document Hierarchy V$VER//EN" \
      $CATALOG
  xmlcatalog --noout --del \
      "-//OASIS//DTD XML Exchange Table Model 19990315//EN" \
      $CATALOG
  xmlcatalog --noout --del \
      "-//OASIS//DTD DocBook XML CALS Table Model V$VER//EN" \
      $CATALOG
  xmlcatalog --noout --del \
      "http://www.oasis-open.org/docbook/xml/$VER" \
      $CATALOG
  xmlcatalog --noout --del \
      "http://www.oasis-open.org/docbook/xml/$VER" \
      $CATALOG

)}

ROOTCATALOG=${INSTALL_ROOT}/etc/xml/catalog
CATALOG=${INSTALL_ROOT}/etc/xml/docbook

unregister_docbook $VERSION
unregister_docbook 4.1.2
unregister_docbook 4.2
unregister_docbook 4.3
unregister_docbook 4.4

xmlcatalog --noout --del \
    "-//OASIS//ENTITIES DocBook XML" \
    $ROOTCATALOG
xmlcatalog --noout --del \
    "-//OASIS//DTD DocBook XML" \
    $ROOTCATALOG
xmlcatalog --noout --del \
    "http://www.oasis-open.org/docbook/" \
    $ROOTCATALOG
xmlcatalog --noout --del \
    "http://www.oasis-open.org/docbook/" \
    $ROOTCATALOG

# unregister entities
xmlcatalog --noout --del \
    "ISO 8879:1986//ENTITIES Publishing//EN" \
    $CATALOG
xmlcatalog --noout --del \
    "ISO 8879:1986//ENTITIES Greek Letters//EN" \
    $CATALOG
xmlcatalog --noout --del \
    "ISO 8879:1986//ENTITIES Box and Line Drawing//EN" \
    $CATALOG
xmlcatalog --noout --del \
    "ISO 8879:1986//ENTITIES Greek Symbols//EN" \
    $CATALOG
xmlcatalog --noout --del \
    "ISO 8879:1986//ENTITIES Added Math Symbols: Negated Relations//EN" \
    $CATALOG
xmlcatalog --noout --del \
    "ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN" \
    $CATALOG
xmlcatalog --noout --del \
    "ISO 8879:1986//ENTITIES Alternative Greek Symbols//EN" \
    $CATALOG
xmlcatalog --noout --del \
    "ISO 8879:1986//ENTITIES Diacritical Marks//EN" \
    $CATALOG
xmlcatalog --noout --del \
    "ISO 8879:1986//ENTITIES Monotoniko Greek//EN" \
    $CATALOG
xmlcatalog --noout --del \
    "ISO 8879:1986//ENTITIES Added Math Symbols: Arrow Relations//EN" \
    $CATALOG
xmlcatalog --noout --del \
    "ISO 8879:1986//ENTITIES Added Math Symbols: Ordinary//EN" \
    $CATALOG
xmlcatalog --noout --del \
    "ISO 8879:1986//ENTITIES Russian Cyrillic//EN" \
    $CATALOG
xmlcatalog --noout --del \
    "ISO 8879:1986//ENTITIES General Technical//EN" \
    $CATALOG
xmlcatalog --noout --del \
    "ISO 8879:1986//ENTITIES Added Math Symbols: Delimiters//EN" \
    $CATALOG
xmlcatalog --noout --del \
    "ISO 8879:1986//ENTITIES Added Latin 1//EN" \
    $CATALOG
xmlcatalog --noout --del \
    "ISO 8879:1986//ENTITIES Added Math Symbols: Binary Operators//EN" \
    $CATALOG
xmlcatalog --noout --del \
    "ISO 8879:1986//ENTITIES Added Latin 2//EN" \
    $CATALOG
xmlcatalog --noout --del \
    "ISO 8879:1986//ENTITIES Added Math Symbols: Relations//EN" \
    $CATALOG
xmlcatalog --noout --del \
    "ISO 8879:1986//ENTITIES Non-Russian Cyrillic//EN" \
    $CATALOG

xmlcatalog --noout --del \
    "ISO 8879:1986" \
    $ROOTCATALOG

rm -rf ${ROOTCATALOG} ${CATALOG}
