XLM Flashcards

1
Q

describe meta-markup languages

A
  • A more flexible approach: Define your own tags!
  • Makes machine-independent data (able to run on a variety of computers)
  • Data can be used for different purposes
  • Any set of tags is an “application”
  • Descriptive markup — make meaning explicit
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

differences between XHTML and HTML5

A

XHTML

  • superseded by HTML5
  • Part of the family of XML markup languages
  • compared to HTML, it is more rigid and strict, you cannot deviate from the syntax; this allows for well-structured, non-erroneous documents
  • not easy to use for other purposes HTML5
  • Able to define new elements (not tags)
  • Still mostly intended for display of documents and objects on the Web
  • Its descriptive properties are still rather limited
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

characteristics of XLM (Extensible Markup Language)

A
  • XML files are plain text files just like HTML files
  • Hence, can be easily, cheapily, and widely accessibly distributed eletronically
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is XML?

A
  • XML stands for eXtensible Markup Language
  • XML is a markup language much like HTML
  • XML was designed to store and transport data
  • XML was designed to be self-descriptive
  • XML is a W3C Recommendation
  • XML is both human-readable and machine-readable.
  • XML keeps it in a structured format when sending because the elements in files are defined.
  • separates style from content
  • supporting validation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The Difference Between XML and HTML

A

XML and HTML were designed with different goals:

  • XML was designed to carry data - with focus on what data is
  • HTML was designed to display data - with focus on how data looks
  • XML tags are not predefined like HTML tags are
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

how is XLM extensible?

A

Most XML applications will work as expected even if new data is added or removed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

is XLM seperate from presentation?

A

Yes, hence many different presentation styles can be applied using CSS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How is XLM related to HTML? When do they work together?

A

In many HTML applications, XML is used to store or transport data, while HTML is used to format and display the same data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How can HTML data be edited through XLM?

A

XML Separates Data from HTML

When displaying data in HTML, data can be stored in separate XML files.

With a few lines of JavaScript code, you can read an XML file and update the data content of any HTML page.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How is XLM used in the industry?

A

Thousands of XML formats exists, in many different industries, to describe day-to-day data transactions:

  • stocks and shares
  • fianncial transactions
  • scientific measurements
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What makes XLM valid?

A

valid means

  • well-formed (correct syntax)
  • correct document structure (DTD)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the high-level structure of XLM?

A

tree structure

one root

All elements can have sub elements (child elements):

root > child > sub-child

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what is the prolog of an XLM document

A

` < ?xml version=”1.0” encoding=”UTF-8”? > `

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

XLM syntax rules

A
  • a XML documents must have ONE root Element per document
  • optional: the XLM prolog
  • all XML elements must have a closing tag
  • tags are case sensitive
  • attribute values must be quoted < p id=”…
  • Element names must start with a letter or underscore (except “xlm”)
  • Element names can contain letters, digits, hyphens, underscores, and periods
  • Element names cannot contain spaces
  • proper nesting
  • don’t use < and & inside elements, use &lt instead
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is an XML Element?

A

Everything from (including) the element’s start tag to (including) the element’s end tag.

may contain:

  • text
  • attributes
  • other elements
  • or a mix of the above
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

what is an empty XLM element?

what are the two ways to write one?

A

an element with no content

< element > < /element >

< element / >

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

use of XLM namespaces

A

XML Namespaces provide a method to avoid element name conflicts using prefix.

In XML, element names are defined by the developer. This often results in a conflict when trying to mix XML documents from different XML applications.

18
Q

what is XSLT?

A

XSLT is a language that can be used to transform XML documents into other formats using using templates (e.g. XLM to HTML).

  • Capable of using any text file as an input
  • Display sub-sets of the elements
  • The recommeded stylesheet language for XLM (far more sophistcated than CSS)
  • Add text to the content of an element
  • Analyse content and take action dependent on what is found
  • Extensible Stylesheet Language Transformations
19
Q

What is the recommeded way to format and style XLM?

How to link a CSS stylesheet to an XML document

A

Using JavaScript or XSLT (better than CSS)

< ?xml-stylesheet type=”text/css”href=”cd_catalog.css”? >

``

20
Q

what is XMLHttpRequest and why is it useful

A

used to request data from a web server

useful because:

  • Update a web page without reloading the page
  • Request data from a server - after the page has loaded
  • Receive data from a server - after the page has loaded
  • Send data to a server - in the background
21
Q

what is an XLM parser

A
  • Before any work can be done with an XML document it needs to be parsed; that is, broken down into its constituent parts with some sort of internal model built up.
  • The XML DOM (Document Object Model) defines the properties and methods for accessing and editing XML.
  • However, before an XML document can be accessed, it must be loaded into an XML DOM object.
  • All modern browsers have a built-in XML parser that can convert text into an XML DOM object.
22
Q

What is the DOM?

A

The DOM defines a standard for accessing and manipulating documents:

  • a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document via a tree-structure
  • DOM created after XML parser finished
  • DOM is widely supported, especially across browsers
  • Alternatives to DOM have been developed because it tends to take up a lot of memory, an issue when dealing with large files
23
Q

What is XPath

A
  • a major element in the XSLT standard
  • enables you to target specific elements and attributes in an XLM document
  • works similar to how paths in a filesystem work (starting with the root…) – called path expressions
24
Q

What is XQuery

(NOT NEEDED FOR EXAM)

A

XQuery finds and extracts elements and attributes from XML documents

  • build on XPath expressions

XQuery can be used to:

  • Extract information to use in a Web Service
  • Generate summary reports
  • Transform XML data to XHTML
  • Search Web documents for relevant information
25
Q

What is a Xlink and Xpointer

A
  • Ways of creating hyperlinks in XML
  • Use markup to link to areas within a document
    • to link to the third section within the second chapter
    • to link to a paragraph that contains “this text”
  • Browser support more limited for XLink (hence tendency to convert to HTML?)
  • Any element in an XML document can behave as a link
26
Q

What does the XLM Validator check?

A

checks the syntax / if it’s “well-formed”

27
Q

How does XLM deal with syntax errors?

A

errors are not allowed, and an application will stop at the error

28
Q

What is the DTD?

A

A document type definition (DTD) defines structure for an XML document (correct elements and attributes according to specified rules and legalities).

two different DTDs used with XML:

  1. DTD - The original Document Type Definition
  2. XML Schema - An XML-based alternative to DTD

Strict rules via Schemas allow XLM developers to find errors early.

29
Q

What is the XLM Schema and how does it look like in code?

A

An XML Schema describes the structure of an XML document, just like a DTD.

An XML document validated against an XML Schema is both “Well Formed” and “Valid”.

More powerful than DTD.

30
Q

How to declare XLM?

A

< ?xml version=”1.0”? >

31
Q

What are XLM applications

Name and briefly describe one XML application

A
  • Applications are a set of markup tags used in one specific discipline (unlike HTML5)
  • Tag sets are defined in document analysis session

MathML

It’s a low-level specification for mathematical and scientific content on the Web and beyond

32
Q

What are the benefits of using XML?

A
  • human and machine readable
  • portable: easily moved from one computer system to another
  • reduces bandwidth in transmission, due to smaller file size than normal text
  • extensibility; if you want to add info, simply create new elements/attributes
  • standard open format; don’t have to “reinvent the wheel” for storing new types of data
  • separation between style and content:
    • the same underlying data can be used in multiple presentation scenarios
    • when moving data, bandwidth is not wasted
  • can represent hierarchical data well (human/computer readable)
  • can represent almost any general kind of data (record, list, tree, etc.)
  • lots of sophisticated tools exist for working with XML in many languages
  • longevity (hopefully) – good foundation for electronic publishing, e-commerce, and digital libraries and archives
  • “multi-purpose” files
  • descriptive information contained in files
33
Q

Uses of XLM

A

XML is often used to represent and store data

  • web servers store data as XML files
  • databases sometimes return query results as XML
  • web services use XML to communicate (e.g. RSS)

keeping track of documents and manage metadata (usually in conjunction with a relational database system)

  • When you want to manipulate content
  • When you want to reuse content for
    • different environments (e.g. convert a file into both web and print media)

*

34
Q

Defining XML applications / Prior to writing XLM

A
  • Full list of tags to be used must be identified and defined
  • Role of Document analysis
    • Identify key features in document
    • Identify structure of document (validation)
    • Choose names for tags
35
Q

What are XLM entities?

A
  • Entities are used to define shortcuts to special characters
    • < for <
    • &UCL; expanded to University College London
36
Q

How can XLM be viewed?

A
  1. Via own software for other processing (usually to manipulate or search content)
  2. Or conversion to (X)HTML for viewing by Web browsers
37
Q
A
38
Q

Weaknesses of XML

A
  • somtimes bulky syntax/structure makes files large; can decrease performance
  • can be hard to formulate data into a good XML format
  • JavaScript code to navigate the XML DOM is bulky and generally not fun
39
Q

Data-centric vs. Document-centric

A

Two main types of XML formats exist:

  1. those used to store pure data, like configuration settings
  2. those used to add metadata to documents, like XHTML

Data-centric formats:

  • raw data is combined with markup to give it meaning, increase usability and interoperability

Document-centric formats:

  • loosely structured content is annotated with metadata (for example, a chapter from a book)
40
Q

What is JSON?

A
  • light-weight form of capturing and exchanging data
  • a data format, written with JavaScript object notation
  • natively supported by all modern browsers (and libraries to support it in old ones)
  • JavaScript Object Notation

Exchanging Data

  • When exchanging data between a browser and a server, the data can only be text.
  • JSON is text, and we can convert any JavaScript object into JSON, and send JSON to the server.
  • We can also convert any JSON received from the server into JavaScript objects.
  • This way we can work with the data as JavaScript objects, with no complicated parsing and translations.