summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2020-01-05 07:40:47 +0000
committerKatolaZ <katolaz@freaknet.org>2020-01-05 07:40:47 +0000
commit2245701946acd39e542918839c9dd80b19f6902e (patch)
tree3b6a9b4ef9df714639cfd1f9e8cb8e217679613a
parentc12282c0074f4af4ef5c41ab489f64576bc932c3 (diff)
add manpage
-rw-r--r--README.md4
-rw-r--r--xml2tsv.167
2 files changed, 69 insertions, 2 deletions
diff --git a/README.md b/README.md
index 5d7fd47..1867a31 100644
--- a/README.md
+++ b/README.md
@@ -45,8 +45,8 @@ Customisation
=============
It is possible to customise several aspects of the output by changing
-values in `config.h`. Please see the comments within that file for more
-details.
+values in `config.h`. Please see the comments within that file or read
+the manpage for more details.
Copying
=======
diff --git a/xml2tsv.1 b/xml2tsv.1
new file mode 100644
index 0000000..f071e2a
--- /dev/null
+++ b/xml2tsv.1
@@ -0,0 +1,67 @@
+.TH XML2TSV 1 "04/01/2020" "" ""
+.SH NAME
+xml2tsv \- simple xml-to-tsv converter
+.SH SYNOPSIS
+.PP
+xml2tsv
+.PP
+.SH DESCRIPTION
+.PP
+xml2tsv is a simple tool to convert XML given on standard input to a list of
+tab-separated-values records. Each XML entry is converted to a line
+like:
+.EX
+
+ /full/path/to/current/entry[TAB]attr1=value1[TAB]attr2=value2[TAB]...[TAB]data[NEWLINE]
+
+.EE
+where
+.I "/full/path/to/current/entry"
+represents the full hierarchy of entries down to the current one. For
+instance, the XML snippet:
+.EX
+
+ <html>
+ <head>
+ <title>This is a title</title>
+ </head>
+ <body>
+ <h1>It works!</h1>
+ <a href="https://my.wonderful.website.net">Click here</a>
+ </body>
+ </html>
+
+.EE
+will produce the output:
+.EX
+
+ /html
+ /html/head
+ /html/head/title This is a title
+ /html/body
+ /html/body/h1 It works!
+ /html/body/a href=https://my.wonderful.website.net Click here
+
+.EE
+By default, xml2tsv quotes '\\n', '\\t', and '\\', and strips other
+control characters.
+.SH CONFIGURATION
+The maximum length of an entry name and the maximum depth of an entry
+are fixed to STR_MAX and DEPTH_MAX, and can be changed by editing the
+file
+.BI config.h
+and rebuilduing xml2tsv. It is also possible to change the separator
+used on output (SEP, by default set to '\\t'), and the character used to
+separate the name of an attribute from its value (SATTR, by default set
+to '=').
+.SH BUGS
+
+xml2tsv currently lacks an option to force printing control characters
+on output, if desired.
+
+.SH AUTHORS
+xml2tsv is written and maintained by Vincenzo "KatolaZ" Nicosia
+<katolaz@freaknet.org>. The code is based on
+.BI xmlparser
+by Hiltjo Posthuma <hiltjo@codemadness.org>. You can use, distribute,
+modify, and redistribute xml2tsv under the terms of the ISC License.