Flashcards in XML Deck (55):
How are XML tags created?
They are user defined
What happens when XML tags are nested?
It forms a hierarchical data structure
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
What does XML stand for?
eXtensible Markup Language
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
How can XML provide a powerful way to handle large amounts of semi-structured data?
When it is used in conjunction with other technologies
What is element content?
Everything from the start tag to the end tag (including the tags themselves
What 4 things can elements have?
- Element Content
- Simple Content
- Empty Content
- Mixed Content
What is an element with simple content?
It contains only data
What is an element with empty content?
It contains no data
What is an element with mixed content?
It contains data and other elements
What is an element with element content?
It contains other elements
What does sub-elements and nesting allow?
It allows us to represent complex hierearchical data
What is meant by: Elements must nest cleanly?
If an element contains another elements start tag, it must also contain its end tag
What 3 ways must an element name start with?
- A letter
- An underscore
- A colon
What can element names only contain?
letters, numbers and other characters
What can element names NOT contain
What are two ways empty elements can be represented?
Can elements contain attributes?
What are rules for attributes?
There are no rules about when to use attributes vs elements, just that attributes must be quoted
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
Should we use attributes or elements for data?
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
What happens if you use an "
It will generate an error, you can replace the character with an entity reference instead
Why would we use an entity reference?
Some characters e.g. " if salary < 1000 then will cause an error because of the " wont
How many entity references in XML are there?
What are the 5 entity references in XML?
What is the root element?
is the parent of all other elements
What terms are used to describe the relationships between elements?
Parent, Child, Siblings
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
What are some advantages of XML?
- Simplifies Data Sharing
- XML Data is stored in plain text format
- Simplifies Data Transport
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
What is valid XML?
Valid XML is well formed XML that also adheres to a document type definition DTD
What is DTD?
Document Type Definition
defines a structure of an XML document using list of legal elements and attributes and their hierarchy
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
What is a reference to an external DTD file?
within the XML file will reference the external Note.dtd file
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
What is an alternative to using a DTD?
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
What does XSD stand for?
Xml Schema Definition
What does DTD stand for?
Document Type Definition
What is the purpose of an XML Schema?
To define the legal building blocks of an XML document, just like DTD
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
How would we use an XML schema?
We must provide a reference to it (like DTD)
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
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
What is the topmost element in the document tree?
Root element node
What does XPath treat an XML document as?
A tree of nodes
What are the 7 categories of node?
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
Why would we use XSLT?
- To display our data in a web browser
- Extract parts of data
- Find Information within data
What does XSLT stand for?
eXtensible Stylesheet language transformations
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
What can you do with XSLT?
- Add/Remove elements or attributes to/from XML files, rearrange or sort elements