Presentation is loading. Please wait.

Presentation is loading. Please wait.

XML Primer. 2 History: SGML vs. HTML vs. XML SGML (1960) XML(1996) HTML(1990) XHTML(2000)

Similar presentations


Presentation on theme: "XML Primer. 2 History: SGML vs. HTML vs. XML SGML (1960) XML(1996) HTML(1990) XHTML(2000)"— Presentation transcript:

1 XML Primer

2 2 History: SGML vs. HTML vs. XML SGML (1960) XML(1996) HTML(1990) XHTML(2000) http://www.w3.org/TR/2006/REC-xml-20060816/

3 XML vs HTML XML is not a replacement for HTML. XML and HTML were designed with different goals: XML was designed to transport and store data, with focus on what data is. HTML was designed to display data, with focus on how data looks. HTML is about displaying information, while XML is about carrying information.

4 Defining XML XML is subset of the Standard Generalized Markup Language (SGML) defined in ISO standard 8879:1986 that is designed to make it easy to interchange structured documents over the Internet. XML files always clearly mark where the start and end of each of the logical parts (called elements) of an interchanged document occurs...It also defines how Internet Uniform Resource Locators can be used to identify component parts of XML data streams.

5 About XML XML Does not DO Anything - XML was created to structure, store, and transport information. XML is Just Plain Text - Software that can handle plain text can also handle XML. XML is Not a Replacement for HTML - XML is a complement to HTML. In most web applications, XML is used to transport data, while HTML is used to format and display the data.

6 Parts of XML Prolog – XML declaration – Processing instructions Elements – Root element – Parents, children, siblings, descendants, ancestors Attributes

7 Sample XML code Robert A+ Scott A-

8 The Prolog This line with special symbols and attributes is what is referred to as the XML declaration. It simply states what version of XML you are using and the type of encoding you are using.

9 Elements The body of an XML code is made up of Elements (root, parent and child) XML documents must contain a root element. This element is "the parent" of all other elements. The elements in an XML document form a document tree. The tree starts at the root and branches to the lowest level of the tree. All elements can have sub elements (child elements):

10 Names of Elements Names can contain letters, numbers, and other characters Names must not start with a number or punctuation character Names must not start with the letters xml (or XML, or Xml, etc) Names cannot contain spaces

11 Elements – Syntax Rules All XML Elements Must Have a Closing Tag XML Tags are Case Sensitive XML Elements Must be Properly Nested XML Documents Must Have a Root Element XML Attribute Values Must be Quoted If an XML document confirms to all these it is well-formed

12 Attributes Attributes are properties of elements. For example, Consider the element “Book”, which can have an attribute “category”. Category of the book can be anything such as children’s book, cooking, etc. All elements can have attributes XML Attribute Values Must be Quoted


Download ppt "XML Primer. 2 History: SGML vs. HTML vs. XML SGML (1960) XML(1996) HTML(1990) XHTML(2000)"

Similar presentations


Ads by Google