relpipe-data/examples-in-xmltable-atom.xml
author František Kučera <franta-hg@frantovo.cz>
Mon, 21 Feb 2022 00:43:11 +0100
branchv_0
changeset 329 5bc2bb8b7946
parent 263 8bf13358a50a
permissions -rw-r--r--
Release v0.18

<stránka
	xmlns="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/strana"
	xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro">
	
	<nadpis>Reading an Atom feed using XMLTable</nadpis>
	<perex>converting arbitrary XML into relational data using XMLTable</perex>
	<m:pořadí-příkladu>02800</m:pořadí-příkladu>

	<text xmlns="http://www.w3.org/1999/xhtml">
		
		<p>
			In this exaple we will achieve the same result as in <m:a href="examples-xquery-atom">previous one with XQuery</m:a>
			but we will use a different tool – <code>relpipe-in-xmltable</code>.
			This approach differs from XQery one in several aspects:
		</p>
		
		<ul>
			<li>no need for writing a script/program – we need just to write an one-liner resp. call one command with parameters</li>
			<li>no need for an external tool like Galax, BaseX or XQilla</li>
			<li>no serialization to the intermediary XML and its immediate deserialization – the XML input is parsed in the same proces which outputs relational data</li>
			<li>simpler (but less powerful) tool – we write only two or more XPath expressions</li>
		</ul>
		
		<p>This is the (shortened) structure of our XML input:</p>

		<m:pre jazyk="xml" src="examples/atom-xmltable.xml"/>

		<p>This pipeline will download the XML data and transform it to two relations:</p>

		<m:pre jazyk="bash" src="examples/atom-xmltable.sh"/>
		
		<p>The first one contains individual entries and the second one contains the common header:</p>
		
		<m:pre jazyk="text" src="examples/atom-xmltable.txt"/>
		
		<p>
			This example shows how to work with namespaces and how to generate multiple relations from a single XML input.
			It also shows that the name of the relation do not have to be a literal but might be derived from the input document.
		</p>
		
		<p>If we add the <code>id</code> attribute to the entries table, we can aggregate entries from various sources and still be able to JOIN them with their metadata.</p>
		
	</text>

</stránka>