XML Flashcards Preview

COMP333 > XML > Flashcards

Flashcards in XML Deck (55):
1

How are XML tags created?

They are user defined

2

What happens when XML tags are nested?

It forms a hierarchical data structure

3

What are 6 ways for a XML document to be well formed?

- There must be a root element
- All elements must have opening and closing tags (element names are case-sensitive)
- Sub elements must be correctly nested
- element names must start with a character or underscore
- element names must not contain whitespace
- entity references should replace special characters

4

What does XML stand for?

eXtensible Markup Language

5

What is XML?

XML is a framework for defining markup languages
It uses tags to define data items, which you define there are no pre-defined tags, it is platform, hardware and software independent

6

How can XML provide a powerful way to handle large amounts of semi-structured data?

When it is used in conjunction with other technologies

7

What is element content?

Everything from the start tag to the end tag (including the tags themselves

8

What 4 things can elements have?

- Element Content
- Simple Content
- Empty Content
- Mixed Content

9

What is an element with simple content?

It contains only data

10

What is an element with empty content?

It contains no data

11

What is an element with mixed content?

It contains data and other elements

12

What is an element with element content?

It contains other elements

13

What does sub-elements and nesting allow?

It allows us to represent complex hierearchical data

14

What is meant by: Elements must nest cleanly?

If an element contains another elements start tag, it must also contain its end tag

15

What 3 ways must an element name start with?

- A letter
- An underscore
- A colon

16

What can element names only contain?

letters, numbers and other characters

17

What can element names NOT contain

whitespace

18

What are two ways empty elements can be represented?

"""<
"/someTag">"


19

Can elements contain attributes?

YES

20

What are rules for attributes?

There are no rules about when to use attributes vs elements, just that attributes must be quoted

21

What are 4 problems with using attributes?

- They cannot contain multiple values (elements can)
- They cannot contain tree structures/nesting (elements can)
- attributes are not easily expandable (for future changes)
- attributes are difficult to read and maintain

22

Should we use attributes or elements for data?

ELEMENTS!

23

What is the best use for attributes?

The best use for attributes is metadata (data about data) e.g. metadata to give an id to seperate pieces of data

24

What happens if you use an "

It will generate an error, you can replace the character with an entity reference instead

25

Why would we use an entity reference?

Some characters e.g. " if salary < 1000 then will cause an error because of the " wont

26

How many entity references in XML are there?

5

27

What are the 5 entity references in XML?

< <
> >
& &
' '
" "

28

What is the root element?

is the parent of all other elements

29

What terms are used to describe the relationships between elements?

Parent, Child, Siblings

30

Why would we make sure our XML we create is well formed?

Because error processing in XML specification states that a program should stop processing as soon as it finds a syntax error, this means it is really easy to cope with errors, just STOP rather than handling lots of error situations

31

What are some advantages of XML?

- Simplifies Data Sharing
- XML Data is stored in plain text format
- Simplifies Data Transport

32

What are some criticisms of XML?

- XML and its extensions have regularly been criticised for verbosity and complexity
- Mapping the basic tree model of XML type systems of programming languages or databases can be difficult, especially when XML is used for exchanging highly structured data between applications

33

What is valid XML?

Valid XML is well formed XML that also adheres to a document type definition DTD

34

What is DTD?

Document Type Definition
defines a structure of an XML document using list of legal elements and attributes and their hierarchy

35

What are ways the DTD can be referenced?

- It can be included in the XML file
- It can be in an external file that is referenced in the XML file

36

What is a reference to an external DTD file?

DOCTYPE declaration
e.g.
within the XML file will reference the external Note.dtd file

37

Why use a DTD?

- Each of your XML files can carry a description of its own format
- Independent groups of people can agree to use a standard DTD for interchanging data
- Your application can use a standard DTD to verify that the data you receive from the outside world is valid
- You can also use a DTD to verify your own data

38

What is an alternative to using a DTD?

XML Schema

39

What is an XML Schema?

An xml-basd alternative supported by W3C which describes the structure of an XML document, it is also referred to as XML Schema Definition XSD

40

What does XSD stand for?

Xml Schema Definition

41

What does DTD stand for?

Document Type Definition

42

What is the purpose of an XML Schema?

To define the legal building blocks of an XML document, just like DTD

43

Why are XML Schemas considered more powerful than DTDs?

- They are extensible to future additions
- They are richer and more powerful that DTDs
- They are written in XML
- They support data types
- They support namespaces

44

How would we use an XML schema?

We must provide a reference to it (like DTD)

45

What are some things XML schemas allow us to do?

- Creation of user-defined datatypes for describing data and attribute values
- Inheritance for element, attribute and datatype definitions
- Embedded documentation within schemas

46

What is XPath?

it is a syntax for defining parts of an XML document, it uses path expressions to navigate in XML documents and XPath contains a library of standard functions

47

What is the topmost element in the document tree?

Root element node

48

What does XPath treat an XML document as?

A tree of nodes

49

What are the 7 categories of node?

- Element
- Attribute
- Text
- Namespace
- Processing-Instruction
- Comment
- Document

50

What does XPath provide? and what does it mean?

Ir provides a powerful mechanism for traversing XML, this means that as well as accessing the entire document, we can also access specific parts of the document

51

Why would we use XSLT?

- To display our data in a web browser
- Extract parts of data
- Find Information within data

52

What does XSLT stand for?

eXtensible Stylesheet language transformations

53

What is XSLT?

It describes how a source document is transformed into a target document
A fully fledged programming language for manipulating and transforming XML, it works in conjunction with XPath

54

What can you do with XSLT?

- Add/Remove elements or attributes to/from XML files, rearrange or sort elements

55

What is a common XSLT transformation?

XML to HTML to allow us to display XML in a web browser