XLM Flashcards
describe meta-markup languages
- 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
differences between XHTML and HTML5
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
characteristics of XLM (Extensible Markup Language)
- XML files are plain text files just like HTML files
- Hence, can be easily, cheapily, and widely accessibly distributed eletronically
What is XML?
- 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
The Difference Between XML and HTML
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 is XLM extensible?
Most XML applications will work as expected even if new data is added or removed.
is XLM seperate from presentation?
Yes, hence many different presentation styles can be applied using CSS
How is XLM related to HTML? When do they work together?
In many HTML applications, XML is used to store or transport data, while HTML is used to format and display the same data.
How can HTML data be edited through XLM?
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 is XLM used in the industry?
Thousands of XML formats exists, in many different industries, to describe day-to-day data transactions:
- stocks and shares
- fianncial transactions
- scientific measurements
What makes XLM valid?
valid means
- well-formed (correct syntax)
- correct document structure (DTD)
What is the high-level structure of XLM?
tree structure
one root”
All elements can have sub elements (child elements):
root > child > sub-child

what is the prolog of an XLM document
` < ?xml version=”1.0” encoding=”UTF-8”? > `
XLM syntax rules
- 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 < instead
What is an XML Element?
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
what is an empty XLM element?
what are the two ways to write one?
an element with no content
< element > < /element >
< element / >
use of XLM namespaces
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.

what is XSLT?
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
What is the recommeded way to format and style XLM?
How to link a CSS stylesheet to an XML document
Using JavaScript or XSLT (better than CSS)
< ?xml-stylesheet type=”text/css”href=”cd_catalog.css”? >
``
what is XMLHttpRequest and why is it useful
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
what is an XLM parser
- 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.
What is the DOM?
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
What is XPath
- 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
What is XQuery
(NOT NEEDED FOR EXAM)
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
What is a Xlink and Xpointer
- 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
What does the XLM Validator check?
checks the syntax / if it’s “well-formed”
How does XLM deal with syntax errors?
errors are not allowed, and an application will stop at the error
What is the DTD?
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:
- DTD - The original Document Type Definition
- XML Schema - An XML-based alternative to DTD
Strict rules via Schemas allow XLM developers to find errors early.

What is the XLM Schema and how does it look like in code?
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.

How to declare XLM?
< ?xml version=”1.0”? >
What are XLM applications
Name and briefly describe one XML application
- 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
What are the benefits of using XML?
- 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
Uses of XLM
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)
*
Defining XML applications / Prior to writing XLM
- 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
What are XLM entities?
- Entities are used to define shortcuts to special characters
- < for <
- &UCL; expanded to University College London
How can XLM be viewed?
- Via own software for other processing (usually to manipulate or search content)
- Or conversion to (X)HTML for viewing by Web browsers
Weaknesses of XML
- 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
Data-centric vs. Document-centric
Two main types of XML formats exist:
- those used to store pure data, like configuration settings
- 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)
What is JSON?
- 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.