Higher Level Dist Tools pt1 Flashcards
What does XML stand for?
In General, what is it?
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.
What are the differences between XML and HTML?
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)
What are the important notes about XML?
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
XML itself does nothing? What does this mean?
XML is not a way to transform data, it is purely description
How is an XML file processed?
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

What does it meal for an XML document to be “well formed”
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.
What does it mean for an XML document to be “valid”?
An XML file’s structure must be described using a Document Type Definition (DTD) file.
In general what is a DTD?
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 is a DTD references/used?
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.
What is the code used in an XML file to refer to it’s DTD definition?

What doe the following DTD file code mean?


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


What are the operators allowed in DTD?

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?
XML supports namespaces to handle this.
What modern implemntation has become the preferred alterative to DTDs?
What are the similarities and benefits?

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


What does XSL stand for?
What is it used for?
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
What is XSLT and what is it used for?

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

How do you iterate over occurrances of elements in an XML specification?
What is the specific code?
<for-each></for-each>
This iterates over each occurrence of the sections element in the root (paper) element.
How would you use XSL to select text “contained in” a given element?

What is JSON?
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
What does it mean for JSON to be “object based” vs “object oriented”?
Typically no polymorphism or dynamic binding
So it is commonly used as a structuring feature
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?
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

How do you generate:
- JSON from objects?
- Objects from JSON?
- JSON.stringify(myObject)
- returns a string containing JSON for the object myObject
- myObject=JSON.parse(JSONstring)
- creates an object myObject with the properties given in JSONstring