Xpath started out as a language for selecting

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

XPath started out as a language for selecting elements and attributes from an XML document while traversing its hierarchy and filtering out unwanted content XPath 1.0 specifies path expressions and a limited set of functions XPath 2.0 now encompasses a wide variety of expressions and functions XQuery 1.0 and XPath 2.0 overlap to a very large degree Have the same data model and the same set of built-in functions and operators XPath 2.0 is essentially a subset of XQuery 1.0 XQuery has a number of features that are not included in XPath, such as FLWORs and XML constructors These features are not relevant to selecting, but instead have to do with struc- turing or sorting query results The two languages are consistent: any expression that is valid in both languages evaluates to the same value using both languages 21 XQuery Versus XSLT XSLT is a language for transforming XML documents into other documents There is a lot of overlap in the capabilities of XQuery and XSLT XSLT 2.0 is based upon XPath 2.0: same data model, built-in functions, and operators as XQuery, many of the same expressions Some differences between XQuery and XSLT 3 XSLT optimized for transforming entire documents; loads the entire input document into memory XQuery optimized for selecting fragments of data, e.g., from a database; designed to be scalable and to take advantage of database features such as indexes for optimization 3 XQuery has a more compact non-XML syntax, which is sometimes easier to read and write (and embed in program code) than the XML syntax of XSLT 3 XQuery designed to select from a collection of documents XSLT 2.0 stylesheets can operate on multiple documents, but XSLT proces- sors are not optimized for this less common use case 22 XQuery – Foundations – 11 XQuery Versus SQL XQuery borrows ideas from SQL, many of the designers of XQuery were also designers of SQL The line between XQuery and SQL may seem clear: XQuery is for XML, and SQL is for relational data This line is increasingly blurred: relational database vendors are putting XML frontends on their products and allowing XML to be stored in relational databases XQuery is unlikely to replace SQL for highly structured data traditionally stored in relational databases Most likely, the two will coexist: XQuery for querying less-structured data, SQL for highly structured relational data 23 XQuery and XML Schema XML Schema is a standard for defining schemas, used to validate XML docu- ments and to assign types to XML elements and attributes XQuery uses the type system of XML Schema, which includes built-in datatypes such as decimal, date, and string XML Schema allows users to define their types based on the built-in types If an input document to a query has a schema, the types can be used when evaluating expressions on the input data This also has the advantages of allowing the processor to better optimize the query and to catch errors earlier
Image of page 6

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

Image of page 7
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