Posts Tagged xml

Learn XML Part1

Keywords: root element, child element, attributes, contents, structure, semantics, style,

Basics:

The XML declaration has version and standalone attributes. An attribute is a name-value pair separated by an equals sign.

<?xml version=”1.0” standalone=”yes”?>

Every XML document begins with an XML declaration that specifies the version ofXML in use. In the above example, the version attribute says this document conforms to XML 1.0. The XML declaration may also have a standalone attribute that tells you whether or not the document is complete in this one file or whether it needs to import other files. In this example, and for the next several chapters, all documents will be complete unto themselves so the standalone attribute is set to yes.

Markup tags can have three kinds of meaning: structure, semantics, and style.

Structure divides documents into a tree of elements. It merely expresses the form of the document, without regard for differences between individual tags and elements.

Semantics relates the individual elements to the real world outside of the document itself. Semantic meaning exists outside the document, in the mind of the author or reader or in some computer program that generates or reads these files.

Style specifies how an element is displayed. Stylemeaning specifies how the content of a tag is to be presented on a computer screen or other output device. ( achieved thru style sheets)

Every good XML document must have a root element. This is an element that completely contains all other elements of the document.

An attribute is a name-value pair associated with an element.

Attributes vs elements

Attributes can’t hold structure well.
Elements allow you to include meta-meta-data (information about the information about the information).
Not everyone always agrees on what is and isn’t meta-data.
Elements are more extensible in the face of future changes

CSS styles only apply to element content, not to attributes.

Leave a Comment