# HG changeset patch # User František Kučera <franta-hg@frantovo.cz> # Date 1544112689 -3600 # Node ID c952261978e8ada3093e44e652a1374cf6f9fb0c # Parent e33f13c9128988fdcf983e8efd5a8d664edee63f examples: relpipe-out-xml diff -r e33f13c91289 -r c952261978e8 relpipe-data/examples.xml --- a/relpipe-data/examples.xml Thu Dec 06 16:15:53 2018 +0100 +++ b/relpipe-data/examples.xml Thu Dec 06 17:11:29 2018 +0100 @@ -157,6 +157,82 @@ n.b. the <code>relpipe-in-fstab</code> reads the <code>/etc/fstab</code> if executed on TTY. Otherwise, it reads the STDIN. </p> + <h3>relpipe-out-xml</h3> + + <p> + Relational data can be converted to various formats and one of them is the XML. + This is a good option for further processing e.g. using XSLT transformation or passing the XML data to some other tool. + Just use <code>relpipe-out-xml</code> instead of <code>relpipe-out-tabular</code> and the rest of the pipeline remains unchanged: + </p> + + <m:pre jazyk="bash"><![CDATA[ssh example.com cat /etc/mtab | relpipe-in-fstab | relpipe-out-xml]]></m:pre> + + <p> + Will produce XML like this: + </p> + + <m:pre jazyk="xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?> +<pipe> + <relation> + <name>fstab</name> + <record> + <attribute>UUID</attribute> + <attribute>29758270-fd25-4a6c-a7bb-9a18302816af</attribute> + <attribute>/</attribute> + <attribute>ext4</attribute> + <attribute>relatime,user_xattr,errors=remount-ro</attribute> + <attribute>0</attribute> + <attribute>1</attribute> + </record> + <record> + <attribute></attribute> + <attribute>/dev/sr0</attribute> + <attribute>/media/cdrom0</attribute> + <attribute>udf,iso9660</attribute> + <attribute>user,noauto</attribute> + <attribute>0</attribute> + <attribute>0</attribute> + </record> + <record> + <attribute></attribute> + <attribute>/dev/sde</attribute> + <attribute>/mnt/data</attribute> + <attribute>ext4</attribute> + <attribute>relatime,user_xattr,errors=remount-ro</attribute> + <attribute>0</attribute> + <attribute>2</attribute> + </record> + <record> + <attribute>UUID</attribute> + <attribute>a2b5f230-a795-4f6f-a39b-9b57686c86d5</attribute> + <attribute>/home</attribute> + <attribute>btrfs</attribute> + <attribute>relatime</attribute> + <attribute>0</attribute> + <attribute>2</attribute> + </record> + <record> + <attribute></attribute> + <attribute>/dev/mapper/sdf_crypt</attribute> + <attribute>/mnt/private</attribute> + <attribute>xfs</attribute> + <attribute>relatime</attribute> + <attribute>0</attribute> + <attribute>2</attribute> + </record> + </relation> +</pipe>]]></m:pre> + + <p> + Thanks to XSLT, this XML can be easily converted e.g. to an XHTML table (<code>table|tr|td</code>) or other format. + Someone can convert such data to a (La)TeX table. + </p> + + <p> + n.b. the format is not final and will change i future versions (XML namespace, more metadata etc.). + </p> + + <h3>relpipe-tr-validator</h3> <p>