From 890ad2bcee172ab2a4cbb319145f5b42ba38619a Mon Sep 17 00:00:00 2001 From: Julian T Date: Thu, 25 Nov 2021 08:47:19 +0100 Subject: Add notes and assignment solution --- sem7/db/lec_xpath.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 sem7/db/lec_xpath.md (limited to 'sem7/db/lec_xpath.md') diff --git a/sem7/db/lec_xpath.md b/sem7/db/lec_xpath.md new file mode 100644 index 0000000..e28bd94 --- /dev/null +++ b/sem7/db/lec_xpath.md @@ -0,0 +1,41 @@ + +Xpath is used for quering information in XML documents. +Can also be used with postgresql databases. + +When using xpath, we query an abstact document structure. +This is also represented by a nodetree. + +NOTE that `/, /something/else` in the slides are two different queries. + +# Nodetree + +**Document node** is the root of the tree, thus the whole element. +Will often contain document metadata, and will point at a single root element. + +**Element** element represent nodes. + +# Location Step + +Stuff between two `/`'s. +Looks like `${axis}::${node test}[${predicate_1}][${predicate_2}]` + +Axis will default to `child`. +But there are many other, which also have abbreviations. + +# Funktioner og Expressions + +Man kan køre funktioner såsom concat. +Og de kan bruge queries. + +``` +concat("hej", /med/dig/text()) +``` + +# Spørgsmål + +Vil det her give root element flere gange. +``` +//course/.. +``` + +Nope det er sets, den vil ikke være der flere gange. -- cgit v1.2.3