relpipe-data/examples/atom-xmltable.sh
author František Kučera <franta-hg@frantovo.cz>
Sat, 26 Oct 2019 20:57:42 +0200
branchv_0
changeset 276 cfaf1fa94154
parent 263 8bf13358a50a
permissions -rwxr-xr-x
rename --keep-file to --file-keep
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
263
8bf13358a50a examples: relpipe-in-xmltable
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
#!/bin/bash
8bf13358a50a examples: relpipe-in-xmltable
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
8bf13358a50a examples: relpipe-in-xmltable
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
get_atom() {
8bf13358a50a examples: relpipe-in-xmltable
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
	wget --quiet --output-document - https://blog.frantovo.cz/agregace/c/?p=10
8bf13358a50a examples: relpipe-in-xmltable
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
	# wget --quiet --output-document - https://blog.frantovo.cz/agregace/k/
8bf13358a50a examples: relpipe-in-xmltable
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
	# cat atom.xml
8bf13358a50a examples: relpipe-in-xmltable
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
}
8bf13358a50a examples: relpipe-in-xmltable
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
8bf13358a50a examples: relpipe-in-xmltable
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
get_atom \
8bf13358a50a examples: relpipe-in-xmltable
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
	| relpipe-in-xmltable \
8bf13358a50a examples: relpipe-in-xmltable
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
		--namespace "a" "http://www.w3.org/2005/Atom" \
8bf13358a50a examples: relpipe-in-xmltable
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
		--relation "/a:feed/a:title" --name-is-xpath \
8bf13358a50a examples: relpipe-in-xmltable
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
			--records "//a:entry" \
8bf13358a50a examples: relpipe-in-xmltable
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
			--attribute "published" string "a:published" \
8bf13358a50a examples: relpipe-in-xmltable
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
			--attribute "title" string "a:title" \
8bf13358a50a examples: relpipe-in-xmltable
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
			--attribute "url" string "a:link/@href" \
8bf13358a50a examples: relpipe-in-xmltable
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
		--relation "metadata" \
8bf13358a50a examples: relpipe-in-xmltable
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
			--records "." \
8bf13358a50a examples: relpipe-in-xmltable
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
			--attribute "id" string "a:id" \
8bf13358a50a examples: relpipe-in-xmltable
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
			--attribute "subtitle" string "a:subtitle" \
8bf13358a50a examples: relpipe-in-xmltable
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
	| relpipe-out-tabular