Section 1: Introduction Flashcards
Introduction
What does stand XML for?
eXtensible Markup Language
What is XML?
A software and hardware independent tool for storing and transporting data.
HTML
Designed to display data, focuses on how data looks.
XML was designed to…
carry data
XML Tags
A set of markers (< , >) that are applied to a data set or document to describe the function of individual elements and codify the hierarchical relationships between them.
XML tags are predefined. True or false?
False, author must invent/define the tags.
XML simplifies:
data sharing, data transport, platform changes, and data availability
XML stores data in plain text format which provides software and hardware independent way of storing, transporting, and sharing data. True or false?
True
XML data ___ be stored in separate XML files.
can
XML Tree
XML documents form a tree structure that starts at the “root” element and branches to the “leaves” or child elements.
All elements must contain…
content and attributes
Attributes
Designed to contain data related to a specific element.
Can elements have sub/child elements?
Yes
Prolog
If included, it is the first line of an XML document that defines the XML version and the character encoding.
XML documents must contain one ___ that is the parent of all other elements.
one root element
Element
Everything from (including) the element’s start tag to (including) the element’s end tag that may contain text, attributes, other elements, or entity references.
Entity Refereneces
A group of characters used in text as a substitute for a single specific character.
What is the default character encoding for XML documents?
UTF-8
UTF-8
A universal, variable-length character encoding (1 to 4 bytes long) set that defines all the characters needed for writing the majority of living languages in use on computers.
Does the prolog require a closing tag?
No, it is not considered a part of the XML document.
XML documents cannot contain internationals characters. True or false?
False
It is illegal to omit the closing tag in XML. True or false?
True
What would the tags of an element named message look like?
<message>This is correct</message>
Opening and closing tags also referred to as…
Start and End tags
All elements must be properly ___ with each other.
nested
Pre-Defined Entity References
< > & ' "
<
( < ) less than symbol
>
( > ) greater than symbol
&
( & ) ampersand symbol
'
( ‘ ) apostrophe
"
( “ ) quotation mark
The parser interprets “<” as the start of a…
new element
Comment Syntax
<!-- This is a comment -->
XML does not remove multiple white spaces. True or false?
True
XML stores a new line as…
line feed (LF)
Line Feed (LF)
A control character used in computing and communications to indicate the end of a line of text and the start of a new line.
An XML element can contain:
text, attributes, other elements, mix of all
Empty XML Element
Does not contain content.
Empty elements cannot have attributes. True or false?
False, empty elements can have attributes.
Element Naming Rules
Names are case-sensitive, must start with a letter or underscore, cannot start with the letters XML, cannot contain spaces, and can contain letters, digits, underscores, and periods.
What is the correct syntax of the declaration which defines the XML version?
<?xml version=”1.0” ?>
Why should you avoid “-“ if you name something “first-name”?
Some software may interpret it as “name” being subtracted from “first”.
Why should you avoid “.” if you name something “first.name”?
Some software may interpret “name” as a property of the object “first”.
Why should colons be avoided in naming elements?
Colons are reserved for namespaces.
Commonly used naming conventions for XML elements:
lower case, upper case, snake case (underscore separates words), pascal case (upper case letter for each word), and camel case (upper case letter for each word except first).
XML documents often have a corresponding ___ and it is common to use the naming rules of it for the XML document..
database
Attribute values must always be quoted using…
single or double quotes
If an attribute value itself contains double quotes, you can use ___ .
single quotes or character entities
What needs to be considered when using attributes?
Attributes cannot contain multiple values or tree structures and are not easily expandable (for future changes).
Elements can contain multiple values and tree structures. True or false?
True
Is <1dollar> a correct name for an XML element?
No, starts with a number.
What is an XML instance?
An XML document.
XML Namespaces
A collection of names that can be used as element or attribute names in an XML document.
XML Namespace Declaration Syntax
xmlns:prefix=”URI”, xmlns is a reserved word that is used only to declare a namespace
When a namespace is defined for an element, all child elements with the same prefix are not associated with the same namespace. True or false?
False, all child element with the same prefix are associated with the same namespace.
Namespace can be declared in the XML ___.
root element
Uniform Resource Identifier (URL)
A string of characters which identifies an Internet Resource.
Uniform Resource Locator (URL)
Identifies an Internet domain address.
What is the most common URI?
URL
Extensible Stylesheet Language Transformations (XSLT)
A language that can be used to transform XML documents into other formats.
Defining a default ___for an element saves us from using prefixes in all the child elements.
namespace
Default Namespace Syntax
xmlns=”namespaceURI”
To view raw XML source, try to select ___ or ___ from the browser menu.
“View Page Source”, “View Source”
XML HttpRequest Object can be used to:
Update a web page without reloading the page
Request or receive data from a server - after the page has loaded
Send data to a server - in the background
XML Parser
A software component that takes input data (usually text) and analyzes it according to a set of rules (grammar) to build a structured representation of the data, essentially breaking down the input into its constituent parts while checking if the syntax is correct.
XML DOM (Document Object Model)
Defines a standard way for accessing and manipulating XML documents.
Before an XML document can be accessed it must be loaded into an ___.
XML DOM object
All XML elements can be accessed through the XML DOM. True or false?
True
XPath
A syntax for defining parts of an XML document, contains a library of standard functions.
What is a correct way of referring to a stylesheet called “mystyle.xsl” ?
<?xml-stylesheet type=”text/xsl” href=”mystyle.xsl” ?>
What XML DOM object represents a node in the node tree?
The node object.
Attributes must occur in defined order. True or false?
False
For the XML parser to ignore a certain section of your XML document, how could it be written?
<![CDATA[ Text to be ignored ]]>
XPath Expression
A simple language within XML that allows users to select specific elements and attributes from a document by identifying pathways through the XML structure.
Extensible Stylesheet Language Transformation (XSLT)
Used to transform XML documents into XHTML documents, or into other XML documents using XPath.
XQuery
A language for finding and extracting elements and attributes from XML documents that is built 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
XLink
Used to create hyperlinks within XML documents.
With XLink, the links can be defined outside the linked files. True of false?
True
XLink Syntax
xlink:href
To get access to the XLink features we must…
declare the XLink namespace
xlink:actuate
Defines when the linked resource is read and shown.
onLoad
Values of xlink:actuate where the resource should be loaded and shown when the document loads.
onRequest
Values of xlink:actuate where the resource is not read or shown before the link is clicked.
xlink:show
Specifies where to open the link. Default value is “replace”.
xlink:show value options
embed, new, replace, other, none
xlink:actuate value options
onLoad, onRequest, other, none
xlink:type
Specifies the type of link.
xlink:type value options
simple, extended, locator, arc, resource, title, or none.
XPointer
Allows links to point to specific parts of an XML document using XPath expressions to navigate the document.
XML Validator
Used to syntax-check XML.
Valid XML Documents
A document that is well formed and conforms to a document type definition.
Document Type Definition (DTD)
Derived from SGML syntax, does not support datatypes or namespace, define order for child elements, and is not extensible.
What is a “well formed” XML document?
An XML document that contains correct syntax.
An XML document validated against a ___ is both “well formed” and “valid”.
DTD
PCDATA
Parseable character data.
An entity declaration has three parts:
it starts with an ampersand (&), then comes the entity name, and it ends with a semicolon (;).
DOCTYPE declaration
Used to define special characters or strings.
XML Schema Definition (XSD)
Written in XML, does support datatypes or namespace, define order for child elements, and is extensible.
Pros for using XSD
XML files can carry a description of its own format.
Independent groups of people can agree on a standard for interchanging data.
Data can be validated.
Since XSD supports data types, it is easier to:
Describe document content
Define restrictions on data
Validate the correctness of data
Convert data between different data types
Hypertext Processor (PHP)
A server scripting language, and a powerful tool for making dynamic and interactive Web pages.
XML cannot be generated on a server without any installed XML software.
False, XML can be generated on a server without any installed XML software.
To generate an XML response from the XML server use ___ or ___.
PHP or ASP
Active Server Pages (ASP)
A development framework for building web pages.
XML can be generated from a database without any installed XML software. True or false?
True
XML files can be stored on an Internet server exactly the same way as HTML files. True or false?
True