Higher Level Dist Tools pt1 Flashcards

1
Q

What does XML stand for?

In General, what is it?

A

eXtensible Markup Language

It is another markup language that adds meda-information to a document (liek HTML)

  • Meta-info is information about information

XML is not about presentation.

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

What are the differences between XML and HTML?

A

In HTML there are pre-defined tags, defined by the HTML specification.

With XML you define your own tags to suit your application

  • eg. <dnasequence> ... </dnasequence>

XML is focused on document content description, not presentation.

Enables effective data structuring and simplified data exchange

  • Meaning, you can define your own data “type” and distribute the type of definition with documents (DTDs and XML schemas)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the important notes about XML?

A

The tags are entirely chosen by the user

  • As long as the code involved agrees, this is fine

There can only be a single “root” tag in any XML document

All tags MUST have matching closing tags

  • <tab> and </tab>

Tags MUST be properly nested

  • <tag1><tag2>...</tag2></tag1>is illegal

White space IS preserved in XML

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

XML itself does nothing? What does this mean?

A

XML is not a way to transform data, it is purely description

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

How is an XML file processed?

A

How an XML file is processed deponds on how an XML-aware application (code) chooses to manipulate the file.

Applications must parse and interpret the XML and then process the tag appropriately

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

What does it meal for an XML document to be “well formed”

A

Any XML document that conforms to the syntactic rules defined by XML is said to be “well formed”

However, just because it is well formed, doesn’t necessarily mean it is valid.

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

What does it mean for an XML document to be “valid”?

A

An XML file’s structure must be described using a Document Type Definition (DTD) file.

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

In general what is a DTD?

A

DTD = Document Type Definition, it describes the structure of a particular type of XML file.

The DTD file can be used:

  • As a reference when creating XML files that are expected to meet the type definition
  • by an application that wishes to process such files to know what it shoudl expect
  • by an XML type checker/verified that can use the DTD to verify that any given XML file conforms to the specfification in the DTD (ie. “is valid”).
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How is a DTD references/used?

A

A DTD can either be provided inline with an XML document or referenced in an external file

  • Of course external is preferred as it is easy to maintain consistency (just like CSS)

Using DTDs, an XML file is self-descriping

  • So you can’t “forget” how to interpret it

DTD repositories can be created so unrelate users can use “standard” XML specifications in their code.

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

What is the code used in an XML file to refer to it’s DTD definition?

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

What doe the following DTD file code mean?

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

What does the following DTD code mean (which is a part of the attached code)

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

What are the operators allowed in DTD?

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

It is possible and likely that a single application may use more than one XML specification

  • Like an app that integrates a number of different systems each with their own DTDs

What happens if there is unintentional name conflicts between multiple DTDs?

A

XML supports namespaces to handle this.

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

What modern implemntation has become the preferred alterative to DTDs?

What are the similarities and benefits?

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

Given the attached XML document, what might the DTD and XML Schema look like?

A
17
Q

What does XSL stand for?

What is it used for?

A

eXtensivle Stylesheet Language (XSL)

Commonly used to associate display characteristics with XML elements

  • In genetal what a “Style sheet” does
    • Just like CSS with HTML to associate presentation with data marked up using HTML
18
Q

What is XSLT and what is it used for?

A
19
Q

How is XSL like/unlike PHP, JSPs, etc?

A
20
Q

How do you iterate over occurrances of elements in an XML specification?

What is the specific code?

A

<for-each></for-each>

This iterates over each occurrence of the sections element in the root (paper) element.

21
Q

How would you use XSL to select text “contained in” a given element?

A
22
Q

What is JSON?

A

JSON = JavaScript Object Notation

XML is widely used for data transfer, and is general and powerful

  • It’s generality is also heavy weight (bulky, slow and complex)

JSON is an alternative to this

It has support for objects (like other scripting languages, perl, python, ruby)

JSON is simple, concise and well-formed

It is very effective for describing structured data that is to be exchanged between components in a distributed system. (this is where its use extends beyond JavaScript)

JSON is typically smaller, faster and easier than XML and is probably prefereable for most apploications moving object-based data

23
Q

What does it mean for JSON to be “object based” vs “object oriented”?

A

Typically no polymorphism or dynamic binding

So it is commonly used as a structuring feature

24
Q

What are the two ways an object might be delcared in Javascript?

For a person, whose name is peter, has blond/grey hair and is aged 55?

A

The second version notation is JSON.

All JSON specification contains is a sequence of ordered key-value pairs (eg. <name: peter>)</name:>

  • These can be nested
    • We could associate favorite foods with the object describing the person
25
Q

How do you generate:

  1. JSON from objects?
  2. Objects from JSON?
A
  1. JSON.stringify(myObject)
    • returns a string containing JSON for the object myObject
  2. myObject=JSON.parse(JSONstring)
    • creates an object myObject with the properties given in JSONstring