--- xml2-0.4.orig/debian/rules
+++ xml2-0.4/debian/rules
@@ -0,0 +1,34 @@
+#!/usr/bin/make -f
+
+# debian/rules file for xml2
+
+# Uncomment this to turn on verbose mode
+# export DH_VERBOSE=1
+
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
+ CONFFLAGS += --build $(DEB_HOST_GNU_TYPE)
+else
+ CONFFLAGS += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
+endif
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+
+%:
+ dh $@ --with quilt,autoreconf
+
+# ./configure $(CONFFLAGS) \
+# --prefix=/usr \
+# --mandir=\$${prefix}/share/man \
+# --infodir=\$${prefix}/share/info \
+# CFLAGS="$(CFLAGS)" \
+# LDFLAGS="-Wl,-z,defs"
+# touch $@
--- xml2-0.4.orig/debian/control
+++ xml2-0.4/debian/control
@@ -0,0 +1,18 @@
+Source: xml2
+Section: utils
+Priority: optional
+Maintainer: Patrick Schoenfeld <schoenfeld@debian.org>
+Homepage: http://ofb.net/~egnor/xml2/
+Vcs-Git: git://git.debian.org/git/collab-maint/xml2.git
+Vcs-Browser: http://git.debian.org/?p=collab-maint/xml2.git
+Standards-Version: 3.8.3
+Build-Depends: debhelper (>= 7.0.50~), libxml2-dev, pkg-config, quilt (>= 0.46-7), dh-autoreconf
+
+Package: xml2
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Convert between XML, HTML, CSV and a line-oriented format
+ xml2 tools are used to convert XML, HTML and CSV to and from a
+ line-oriented format more amenable to processing by classic Unix
+ pipeline processing tools, like grep, sed, awk, cut, shell scripts,
+ and so forth.
--- xml2-0.4.orig/debian/README.source
+++ xml2-0.4/debian/README.source
@@ -0,0 +1,6 @@
+This package uses quilt to manage all modifications to the upstream
+source. Changes are stored in the source package as diffs in
+debian/patches and applied during the build.
+
+Further information can be found here (with the quilt package installed):
+/usr/share/doc/quilt/README.source.gz
--- xml2-0.4.orig/debian/changelog
+++ xml2-0.4/debian/changelog
@@ -0,0 +1,100 @@
+xml2 (0.4-3.1) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * Fix "FTBFS: gcc: error: unrecognized option '-V'":
+ + update debian/rules:
+ - use quilt and dh-autoreconf debhelper plugins
+ - let dh(1) handle the rest
+ + update build dependencies accordingly
+ (Closes: #666290)
+
+ -- gregor herrmann <gregoa@debian.org> Mon, 16 Apr 2012 18:29:39 +0200
+
+xml2 (0.4-3) unstable; urgency=low
+
+ * Updated maintainer email address
+ * Add a file README.source to document the patch handling
+ * Updated Standards-Version
+ * 2csv: Include a patch to not segfault, if there are empty values.
+ (Closes: #499610)
+ * Fix some minor mistakes in the manpage
+ * Update to debconf 7 and simplify debian/rules
+ * Switch to quilt as a patchsystem
+ * Add debian/manpages
+ * Stop using 'dh_clean -k'
+ * Update Vcs-Headers to reflect switch to git
+
+ -- Patrick Schoenfeld <schoenfeld@debian.org> Thu, 03 Dec 2009 11:09:31 +0100
+
+xml2 (0.4-2) unstable; urgency=low
+
+ * Added dpatch as a patch system
+ * Transition to libxml2:
+ + Added a patch to use libxml2 instead of libxml
+ Thanks to Daniel Leidert for the patch.
+ + Changed build-depend for libxml-dev to libxml2-dev
+ (Closes: #470013)
+ * Added build-depends on autotools-dev, autoconf and automake,
+ because configure needs to be regenerated
+ (it is being patched by the libxml2 patch)
+ * Moved every action configure does to a newly created configure-stamp
+ target and run autoreconf before running configure
+ * Delete autoconf files in clean target (they are being re-generated in the
+ configure-stamp rule)
+
+ -- Patrick Schoenfeld <schoenfeld@in-medias-res.com> Mon, 10 Mar 2008 10:38:58 +0100
+
+xml2 (0.4-1) unstable; urgency=low
+
+ * New upstream release:
+ + Autoconf is used to build the package
+ * Updating debian/rules to use autoconf to configure, make and install
+ the progam files
+ * Added a build-depend on pkg-config in order to let configure function
+ properly
+ * Updated debian/copyright to include the year of the copyright to fix a
+ lintian warning
+ * Added a manpage (Closes: #388582)
+ * Added debian/links with link targets and change dh_link call in
+ debian/rules file accordingly.
+ * Decreased debhelper compat level to 5 as compat level 6 is not really
+ needed and its easier for backporters this way.
+ * Added ${misc:Depends} to binary package depends, if debhelpers should
+ make use of them
+
+ -- Patrick Schoenfeld <schoenfeld@in-medias-res.com> Thu, 07 Feb 2008 20:51:27 +0100
+
+xml2 (0.3-2) unstable; urgency=low
+
+ * New maintainer (Closes: #455008)
+ * Added a watch file
+ * Change to debhelper as a buildsystem:
+ + Added build-depend on debhelper
+ + Added debian/compat file
+ + Rewritten debian/rules to use debhelper
+ * Updated Standards-Version (Closes: #263367)
+ * Updated copyright file; included license excerpt
+ * Added Vcs-headers to debian/control
+ * Added the new Homepage field to debian/control
+ * Install html2 and 2html as symlinks (Closes: #111606)
+ * Removed post-installation and pre-removal scripts because they are not
+ needed anymore
+
+ -- Patrick Schoenfeld <schoenfeld@in-medias-res.com> Sun, 27 Jan 2008 15:13:14 +0100
+
+xml2 (0.3-1.1) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * Get rid of the /usr/doc link in postinst (Closes: #359608).
+ * Remove build-essential gzip from build-depends.
+ * Fix the copyright file
+ * Updated standards version, no changes needed
+
+ -- Amaya Rodrigo Sastre <amaya@debian.org> Sun, 16 Jul 2006 15:41:28 +0200
+
+xml2 (0.3-1) unstable; urgency=low
+
+ * Initial Release.
+
+ -- Tommi Virtanen <tv@debian.org> Sun, 24 Jun 2001 22:13:30 +0300
+
--- xml2-0.4.orig/debian/xml2.1
+++ xml2-0.4/debian/xml2.1
@@ -0,0 +1,50 @@
+.TH XML2 1 "7h february 2008"
+.SH NAME
+xml2 \- convert xml documents in a flat format
+
+2xml \- convert flat format into xml
+
+html2 \- convert html documents in a flat format
+
+2html \- convert flat format into html
+
+csv2 \- convert csv files in a flat format
+
+2csv \- convert flat format into csv
+.SH SYNOPSIS
+<xml2|2xml|html2|2html|csv2|2csv> > outfile < infile
+
+
+.SH DESCRIPTION
+There are six tools. Except csv2 and and 2csv they don't take
+any command-line arguments.
+They are all simple filters which can be used to read files from
+standard input in one format and output it to standard output in
+another format.
+
+The flat format used by the tools is specific to these tools.
+It is a syntax for representing structured markup in a way that
+makes it easy to process with line-oriented tools.
+The same format is used for HTML and XML; in fact, you can think
+of html2 as converting HTML to XHTML and running xml2 on the result;
+likewise 2html and 2xml. (Of course, this isn't how the implementation works.)
+.SH SEE ALSO
+This program does normally not include any documentation in form of manpages.
+However it has a real excellent documentation online with a lot of example.
+In fact this manpage was based on this documentation.
+
+Please find it on:
+
+http://dan.egnor.name/xml2/ref
+
+Examples can be found here:
+
+http://dan.egnor.name/xml2/examples
+.SH AUTHOR
+xml2 was written by Dan Egnor.
+
+This manpage was written by Patrick Schoenfeld <schoenfeld@in-medias-res.com>
+for the Debian project, but may be used by others under the same terms as xml2
+is distributed.
+.SH BUGS
+Bugs can be reported through the Debian Bug tracking system.
--- xml2-0.4.orig/debian/compat
+++ xml2-0.4/debian/compat
@@ -0,0 +1 @@
+7
--- xml2-0.4.orig/debian/manpages
+++ xml2-0.4/debian/manpages
@@ -0,0 +1 @@
+debian/xml2.1
--- xml2-0.4.orig/debian/copyright
+++ xml2-0.4/debian/copyright
@@ -0,0 +1,29 @@
+This package was debianized by Tommi Virtanen tv@debian.org on
+Sun, 24 Jun 2001 22:14:14 +0300.
+
+It was downloaded from http://ofb.net/~egnor/xml2/
+
+Upstream Author: Dan Egnor <egnor@ofb.net>
+ (address may be spam protected, use egnor-n.n.n.n@ofb.net
+ where n.n.n.n is your IP address)
+
+Copyright holder: (C) 2000 Daniel Egnor <egnor@ofb.net>
+
+License:
+
+ This package is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this package; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+On Debian systems, the full text of this license can be found in
+/usr/share/common-licenses/GPL.
--- xml2-0.4.orig/debian/watch
+++ xml2-0.4/debian/watch
@@ -0,0 +1,2 @@
+version=3
+http://download.ofb.net/gale/xml2-(.*)\.tar\.gz
--- xml2-0.4.orig/debian/links
+++ xml2-0.4/debian/links
@@ -0,0 +1,7 @@
+usr/share/man/man1/xml2.1.gz usr/share/man/man1/2xml.1.gz
+usr/share/man/man1/xml2.1.gz usr/share/man/man1/html2.1.gz
+usr/share/man/man1/xml2.1.gz usr/share/man/man1/2html.1.gz
+usr/share/man/man1/xml2.1.gz usr/share/man/man1/2csv.1.gz
+usr/share/man/man1/xml2.1.gz usr/share/man/man1/csv2.1.gz
+usr/bin/xml2 usr/bin/html2
+usr/bin/2xml usr/bin/2html
--- xml2-0.4.orig/debian/patches/01_use_libxml2_instead_of_libxml.diff
+++ xml2-0.4/debian/patches/01_use_libxml2_instead_of_libxml.diff
@@ -0,0 +1,70 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 01_use_libxml2_instead_of_libxml.dpatch by Daniel Leidert
+## <daniel.leidert@wgdd.de>
+##
+## DP: Make use of libxml2 instead of libxml
+
+@DPATCH@
+diff -urNad xml2-0.4~/2xml.c xml2-0.4/2xml.c
+--- xml2-0.4~/2xml.c 2003-12-24 21:28:48.000000000 +0100
++++ xml2-0.4/2xml.c 2008-03-12 09:32:17.345380803 +0100
+@@ -24,7 +24,7 @@
+ #include <assert.h>
+ #include <ctype.h>
+
+-#include <HTMLparser.h>
++#include <libxml/HTMLparser.h>
+
+ int do_html;
+ int in_tag = 0;
+@@ -104,7 +104,7 @@
+ fputs("/>",stdout);
+ else {
+ const htmlElemDesc *elem = NULL;
+- if (do_html) elem = htmlTagLookup(name);
++ if (do_html) elem = htmlTagLookup((xmlChar *) name);
+ finish_tag();
+ if (NULL == elem || (!elem->endTag && !elem->empty)) {
+ fputs("</",stdout);
+diff -urNad xml2-0.4~/Makefile.am xml2-0.4/Makefile.am
+--- xml2-0.4~/Makefile.am 2008-02-07 16:58:13.000000000 +0100
++++ xml2-0.4/Makefile.am 2008-03-12 09:32:17.345380803 +0100
+@@ -1,9 +1,9 @@
+-AM_CPPFLAGS = $(XML_CFLAGS)
++AM_CFLAGS = $(XML_CFLAGS)
+ bin_PROGRAMS = xml2 2xml csv2 2csv
+ xml2_SOURCES = xml2.c
+-xml2_LDADD = -lxml
++xml2_LDADD = $(XML_LIBS)
+ 2xml_SOURCES = 2xml.c
+-2xml_LDADD = -lxml
++2xml_LDADD = $(XML_LIBS)
+ csv2_SOURCES = csv2.c
+ 2csv_SOURCES = 2csv.c
+
+diff -urNad xml2-0.4~/configure.ac xml2-0.4/configure.ac
+--- xml2-0.4~/configure.ac 2008-02-07 17:11:54.000000000 +0100
++++ xml2-0.4/configure.ac 2008-03-12 09:32:17.345380803 +0100
+@@ -11,7 +11,7 @@
+ AC_PROG_CC
+
+ # Checks for libraries.
+-PKG_CHECK_MODULES(XML, libxml)
++PKG_CHECK_MODULES(XML, libxml-2.0)
+ AC_SUBST(XML_LIBS)
+ AC_SUBST(XML_CFLAGS)
+
+diff -urNad xml2-0.4~/xml2.c xml2-0.4/xml2.c
+--- xml2-0.4~/xml2.c 2001-10-28 05:29:46.000000000 +0100
++++ xml2-0.4/xml2.c 2008-03-12 09:32:17.345380803 +0100
+@@ -24,8 +24,8 @@
+ #include <string.h>
+ #include <ctype.h>
+
+-#include <parser.h>
+-#include <HTMLparser.h>
++#include <libxml/parser.h>
++#include <libxml/HTMLparser.h>
+
+ struct node
+ {
--- xml2-0.4.orig/debian/patches/02_fix_segfault.diff
+++ xml2-0.4/debian/patches/02_fix_segfault.diff
@@ -0,0 +1,21 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 01_use_libxml2_instead_of_libxml.dpatch by
+## <pr0gress0r@ngs.ru>
+##
+## DP: Don't segfault on empty values
+
+@DPATCH@
+--- xml2.orig/2csv.c 2009-02-25 15:07:18.000000000 +0100
++++ xml2/2csv.c 2009-02-25 15:08:40.000000000 +0100
+@@ -83,7 +83,10 @@
+ && !strcmp(buffer + len - field_len[i],argv[i])
+ && (field_len[i] == len
+ || '/' == buffer[len - field_len[i] - 1]))
+- fields[i] = strdup(eq);
++ if (eq)
++ fields[i] = strdup(eq);
++ else
++ fields[i] = strdup("");
+ }
+
+ len = 0;
--- xml2-0.4.orig/debian/patches/series
+++ xml2-0.4/debian/patches/series
@@ -0,0 +1,2 @@
+02_fix_segfault.diff
+01_use_libxml2_instead_of_libxml.diff