XML Introduction Flashcards

1
Q

Fully Structured Data

A

This is where data in a relational model is structured and has to fit a schema, like Module(code, name).

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

Unstructured Data

A

Things like music and image files, where it is completely free on how to organise data.

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

Semi-structured Data

A

This contains no schema, and it flexible, but is also self-describing in a way.

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

Semi-structured Data model

A

A data model for the semi-structured data may be thought as a collection of nodes and edges in a tree-like manner.

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

Applications for semi-structured data

A
  • Storing and sharing data on the web
  • Storage of documents
  • Data analytics and big data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Forms of semi-structured data

A
  • XML
  • JSON
  • Simple key-value relationships
  • Graphs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

XML

A

XML files have a very similar structure to HTML files, where you have items in backets, <>, which descend to represent lower details in the tree.

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

XML Elements

A

Anything that is contained within an elements start tag and end tag, and can contain text, attributes and/or other elements.

<price>1.99</1.99>
</price>

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

Element Parents

A

Since we work in a top-down structure, we can nest elements within each other to declare hierarchy.

<person>
<student>
</student>
</person>

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

Attributes

A

Things that help define elements.
<person hair=”blonde”
</person
They can be very helpful in defining references.

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

Two ways of defining XML file format

A

DTD and XML Schema.

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

DTD

A

Document type definitions.
Provided information about the structure of the document.

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

DTD includes

A
  • elements
  • sub-elements
  • attributes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

<!DOCTYPE lecturers [

]>

A

Beginning of XML document.
Lecturers is the root name.

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

<!ELEMENT lecturers (lecturer+)>

A

+ means that there must be one or more lecturer in lecturer.

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

<!ELEMENT lecturer (name, phone?, email?, teaches*)>

A

Name is required, but we don’t have permission for multiple unlike using +.
Phone and email are optional, and can either have ONE or none.
Teachers can either have none, or many. So the lecturer could teach nothing, one lesson or multiple lessons.

17
Q

DTD Format

A

When defining elements with child nodes in DTD, they have to be stated later on.
For example:
<!ELEMENT lecturer (name, phone, email)>
Since this element has name, phone and email, they need to be defined later in the document like this:
<!ELEMENT lecturer (name, phone, email)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT phone (#PCDATA)>
<!ELEMENT email (#PCDATA)>

18
Q

PCDATA

A

Special symbol for text data.

19
Q

Defining attributes in DTD

A

Lets say you have, in XML:
<student name=”Jake” year=2
In DTD, we represent this differently:
<!ELEMENT student EMPTY>
<!ATTLIST student name CDATA #IMPLIED>
<!ATTLIST student year CDATA #REQUIRED>

20
Q

ATTLIST

A

Simply enough, attribute list.

21
Q

IMPLIED

A

Means optional.

22
Q

REQUIRED

A

Means required.

23
Q

FIXED

A

Means a constant.

24
Q

CDATA

A

Character data, containing any text.

25
Q

ID

A

Used to identify individual elements in documents.

26
Q

IDREF/IDREFS

A

Must correspond to value of ID attributes for some element in document.
Essentially allows a unique key to identify multiple elements.

27
Q

ID example

A

<lecturer>
<!ATTLIST lecturer staffNo ID #required>
</lecturer>

28
Q

Two levels of document processing

A
  • well-formed
  • valid
29
Q

DTD Document Processing
Validating/non-validating processors

A

Non-validating processor ensures XML document is well-formed before passing information onto application.
Validating processor will not only check for well-formedness, but also if it conforms to a DTD, which results in it being valid.