Xquery users are not required to use schemas it is

Info icon This preview shows pages 6–9. Sign up to view the full content.

XQuery users are not required to use schemas: it is possible to write a complete query with no mention of schemas or any of the schema types However, functions and operators operate on typed data, so it is useful to un- derstand the type system and use the built-in types, even if no schema is present 24 XQuery – Foundations – 12
Image of page 6

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

The XQuery Data Model Used to define formally all the values used within queries Officially known as the XQuery 1.0 and XPath 2.0 Data Model, or XDM It is not the same as the Infoset (the W3C model for XML documents) because it has to support values that are not complete XML documents, such as sequences of elements (without a single outermost element) and atomic values 3 Node : An XML construct such as an element or attribute 3 Atomic value : A simple data value with no markup associated with it 3 Item : A generic term that refers to either a node or an atomic value 3 Sequence : An ordered list of zero, one, or more items 25 Nodes Used to represent XML constructs such as elements and attributes XQuery uses six kinds of nodes 3 Element nodes : Represent an XML element 3 Attribute nodes : Represent an XML attribute 3 Document nodes : Represent an entire XML document (not its outermost element) 3 Text nodes : Represent some character data content of an element 3 Processing instruction nodes : Represent an XML processing instruction 3 Comment nodes : Represent an XML comment 26 XQuery – Foundations – 13 The Node Family Each node can have a number of relatives 3 Children : An element may have zero, one, or several other elements as its children. It can also have text, comment, and processing instruction children. Attributes are not considered children of an element. A document node can have an element child (the outermost element), as well as comment and processing instruction children. 3 Parent : The parent of an element is either another element or a document node. The parent of an attribute is the element that carries it 3 Ancestors : A node’s parent, parent’s parent, etc. 3 Descendants : A node’s children, children’s children, etc. 3 Siblings : The other children of its parent. Attributes are not considered to be siblings. 27 Node Identity and Name Every node has a unique identity Two XML elements in the input document may contain the exact same data , but that does not mean they have the same identity Identity is unique to each node and is assigned by the query processor Identity values cannot be retrieved, but identities can be compared with the is operator In addition to their identity, element and attribute nodes have names These names can be accessed using the built-in functions node-name , name , and local-name 28 XQuery – Foundations – 14
Image of page 7
String and Typed Values of Nodes Two kinds of values for a node: string and typed All nodes have a string value 3 Element node: its character data content and that of all its descendant ele- ments concatenated together 3 Attribute node: the attribute value
Image of page 8

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Image of page 9
This is the end of the preview. Sign up to access the rest of the document.
  • Winter '15
  • MAhmoudali

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern