|
1 <stránka |
|
2 xmlns="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/strana" |
|
3 xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro"> |
|
4 |
|
5 <nadpis>Reading an Atom feed using XMLTable</nadpis> |
|
6 <perex>converting arbitrary XML into relational data using XMLTable</perex> |
|
7 <m:pořadí-příkladu>02800</m:pořadí-příkladu> |
|
8 |
|
9 <text xmlns="http://www.w3.org/1999/xhtml"> |
|
10 |
|
11 <p> |
|
12 In this exaple we will achieve the same result as in <m:a href="examples-xquery-atom">previous one with XQuery</m:a> |
|
13 but we will use a different tool – <code>relpipe-in-xmltable</code>. |
|
14 This approach differs from XQery one in several aspects: |
|
15 </p> |
|
16 |
|
17 <ul> |
|
18 <li>no need for writing a script/program – we need just to write an one-liner resp. call one command with parameters</li> |
|
19 <li>no need for an external tool like Galax, BaseX or XQilla</li> |
|
20 <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> |
|
21 <li>simpler (but less powerful) tool – we write only two or more XPath expressions</li> |
|
22 </ul> |
|
23 |
|
24 <p>This is the (shortened) structure of our XML input:</p> |
|
25 |
|
26 <m:pre jazyk="xml" src="examples/atom-xmltable.xml"/> |
|
27 |
|
28 <p>This pipeline will download the XML data and transform it to two relations:</p> |
|
29 |
|
30 <m:pre jazyk="bash" src="examples/atom-xmltable.sh"/> |
|
31 |
|
32 <p>The first one contains individual entries and the second one contains the common header:</p> |
|
33 |
|
34 <m:pre jazyk="text" src="examples/atom-xmltable.txt"/> |
|
35 |
|
36 <p> |
|
37 This example shows how to work with namespaces and how to generate multiple relations from a single XML input. |
|
38 It also shows that the name of the relation do not have to be a literal but might be derived from the input document. |
|
39 </p> |
|
40 |
|
41 <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> |
|
42 |
|
43 </text> |
|
44 |
|
45 </stránka> |