XML Flashcards

1
Q

Features of XML tags - 6 things

A
  • case sensitive i.e <H1> and <h1> are different
  • in XML you can never omit an end tag
  • XML elements that have a single tag without a matching end tag must end in a / e.g <img=src=”coffeecup.png”/>
  • XML attributes must be enclosed in quotation “ marks
  • XML - all attributes should have values
  • <input></input>. is wrong as checked has no value

Horstmann, Cay S.. Core Java (p. 156). Pearson Education. Kindle Edition.

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

XML documents - two features

A
  • start with a header - <?xml version=”1.0” encoding=”UTF-8”?>
  • schema is defined in an xsd document
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

character references in XML in hex or decimal

A

e.g. &#233; ( decimal)

or &#xE9; (hex)

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

What is a DTD (document type definition)

A

DTDs are NOT required but are used to ensure the correctness of the document

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

What is the root element of an XML file ?

A

It is essentially the highest level node that contains all of the other XML data

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

What is an Entity Reference ?

A

entity references have the form
&lt - for less than
&gt - for greater than
&amp - for ampersand
&apo - apostrophe

etc…

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

What is CDATA ?

A

CDATA sections are delimeted by

[CDATA[ and ]]>

used to include strings of data that contains the < > & symbols

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

What is the syntax for XML processing instructions ?

A

delimeted by <? and ?>

e.g. <?xml version=”1.0” encoding=”UTF-8”?>

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

What is XML Parsing ?

A

To process an XML doc you need to Parse it using a Parser.
There are two kinds
DOM Parser - reads an XML file into a Tree Structure

SAX Parser - reads an XML file and generates events

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

What is a DOM Parser ?

A

Simply put, a DOM parser works on the entire XML document, loads it into memory and constructs a tree representation of the document.

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

What is XSD ?

A

XML Schema Definition (XSD) is currently the de facto standard for describing XML document

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

How would an XML element be described in an XSD ?

A

<xs:element></xs:element>

e.g. <xs:element></xs:element>

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

What are the predefined simple types in the XSD standard ?

A

xs:string, xs:integer, xs:boolean and xs:date are examples

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

What is attribute “default” for ?

A

To provide a value if none given

<xs:element></xs:element>

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

What is attribute “fixed” for ?

A

This means the value in the XML can only have this value

<xs:element></xs:element>

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

What is a Simple Type ?

A

It is possible to define bespoke simple types.
these can be constrained with regular expressions
there are best practices to follow