XML Flashcards

1
Q

XML is extensible (not fixed) but which markup is indifferent across all XML languages and how is it written?

A

Metadata

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

Database vs XML

A

data centric means it is largely intended for auto processing, has to be easily identifiable & have regular structure should be database

document centric means it should be more human readable with maybe a little less structure. This should be xml

XML is self describing [structure of the document is within the document itself
Although XML parsing & processing can be slow. Also missing key db features (index, security, queries etc)

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

XML is an ordered, labelled tree. Name & describe its nodes

A

Character data: leaf node contain actual data (text strings)

Element Nodes: labellled with a tag and a set of attributes.

Other Leaf nodes:

  1. Attribute Nodes
  2. Processing instructions - annotations for vatious processors
  3. Comments
  4. Document Type Declaration
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Basic XML Syntax Rules

A
  1. Must have unique root element
  2. Element names are any length and are aplhanumeric with underscores, hyphens and period. Must begin with alpha or underschore. No spaces!
  3. Element names are case SeNsItIvE
  4. Every tag should have an open and close (in that order).
  5. Child closed before folks
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is Character Data?

A

String Data which supports:

  1. Carraige Returns
  2. Line Feeds
  3. Unicode Characters

Whitespace is preserved by XML parsers!

Reserved chars: & | < | > | ‘ | “

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

What are entity references?

A

Allows you to include reserved characters in your XML data [&entity-name]

& = &

< = <

> = >

' = ‘

" = “

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

True or False?

Attributes only describe one element?

A

False

Attributes descibe element and it’s children.

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

What are processing instructions?

Give an example.

A

Processing data is metadata about the XML document intended for processing tools.

Typical examples are declaring which version of XML you are using & declareing which stylesheet should be applied.

Belongs as the first line all you xml documents

<?xml version=”1.0”?>

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

What would be the best way to include Code in your xml?

A

Using cdata sections

To avoid using entity references. CData will designate portions of the XML document to be skipped over by the parser and treat as pure string of character data.

The only text that isn’t excluded is ]] as it’s CDATA closing tags

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

Why are namespaces used?

Give an example.

A

XML Namespaces provide a method to avoid element name conflicts and are defined by the developer.

They allow metadata tags to be created uniquely with respect to all other Markup language by using xmlns:namespace = “AnyUniqueString”

Tip: URL’s are a good way to ensure uniqueness “http://melenie.co.uk/library/book/hello”

[But it’s not 100%]

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

Can the default namespace be used in conjunction with named namespaces?

A

Yes!

This will identify a unique namespace with the unique string used and any tags used in the document will associated with that unique namespace

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

In what way can semantic (meaningful) content be added to xml?

A

CSS

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

How can you define an XML Language

A

Using DTD or Schemas

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