Professional Documents
Culture Documents
Our goals
What is XML? XML Syntax Rules XML Elements Naming Rules XML Attributes XML Validation XML Related Technologies XML Quiz
What is XML?
What is XML?
XML stands for EXtensible Markup Language XML is a markup language much like HTML XML was designed to describe data XML tags are not predefined. You must define your own tags XML is a W3C Recommendation (10. February 1998.)
What is XML?
Usage of XML
Data can be exchanged between incompatible systems. Information can be exchanged over the Internet.
The syntax rules of XML are very simple and very strict.
Example:
<?xml version="1.0" ?> <employee> <name>Arun Prakash</name> <id>12345</id> <age>28</age> <department> <name>EAI</name> <location>Tidel park</location> </department> <experience>8</experience> </employee>
<?xml version="1.0" ?> <?xml version="1.0" encoding="ISO-8859-1"?> Defines the XML version and the character encoding used in the document.
Example:
<?xml version="1.0" ?> <employee> <-- ROOT ELEMENT <name>Arun Prakash</name> <id>12345</id> <age>28</age> <department> <name>EAI</name> <location>Tidel park</location> </department> <experience>8</experience> </employee>
<?xml version="1.0" ?> <name>Arun Prakash</name> <id>12345</id> <age>28</age> <department> <name>EAI</name> <location>Tidel park</location> </department> <experience>8</experience>
10
11
12
13
14
<?xml version="1.0" ?> <employee> <name>Arun Prakash</name> <id>12345</id> <age>28</age> <department> <name>EAI</name> <location>Tidel park </department> <experience>8</experience> </employee>
Chennai</location>
15
16
17
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 Names should not have semi colon (:) its reserved for something called namespace
18
Should not start with number Some special characters are allows No spaces Should not start with word xml / XML / xML etc Semi colon not allowed No restriction on element length
19
XML Attributes
20
XML Attributes
<elementName attributeName=attributeValue>elementValue </elementName>
n number of attributes can be defined in a element Attribute values must always be enclosed in quotes, but either single or double quotes can be used. attributes cannot contain multiple values attributes name should not be repeated in the same element (Check)
21
XML Attributes
Example:
<?xml version="1.0" ?> <employee id=12345 age=28> <name>Arun Prakash</name> <department name=EAI> <location>Tidel park</location> </department> <experience>8</experience> </employee>
22
XML Validation
23
XML Validation
A "Well Formed" XML document has correct XML syntax. A "Well Formed" XML document is a document that conforms to the XML syntax rules:
XML documents must have a root element XML elements must have a closing tag XML tags are case sensitive XML elements must be properly nested XML attribute values must always be quoted XML attribute may appear more than once on the same start-tag. XML elements name follows the naming syntax rules
24
XML Validation
Valid XML Documents : A "Valid" XML document also conforms to a XML definition (DTD / XML Schema) A "Valid" XML document is a "Well Formed" XML document, which is according to the XML structure defined in DTD or XML Schema (more about it later) the naming syntax rules
25
26
XHTML (Extensible HTML) is a stricter and cleaner version of HTML. XSL (Extensible Style Sheet Language) - XSL consists of three parts
XSLT (XSL Transformations)- a language for transforming XML documents XPath - a language for navigating in XML documents XSL-FO (Formatting Objects) - a language for formatting XML documents.
27
XSD (XML Schema) is an XML-based alternative to DTDs. DTD (Document Type Definition) is used to define the legal elements in an XML document. XQuery (XML Query Language) is designed to query XML data. SOAP (Simple Object Access Protocol) is an XML-based protocol to let applications exchange information over HTTP.
28
WSDL (Web Services Description Language) is an XMLbased language for describing web services. XLink (XML Linking Language) is a language for creating hyperlinks in XML documents. XPointer (XML Pointer Language) allows the XLink hyperlinks to point to more specific parts in the XML document.
29
Quiz
30
Quiz
1. What does XML stand for?
eXtensible Markup Language X-Markup Language Example Markup Language Xtra Modern Link
31
Quiz
2. There is a way of describing XML data, how?
XML uses a description node to describe data XML uses a DTD to describe the data XML uses XSL to describe data
32
Quiz
3. XML's goal is to replace HTML
False True
Answer : False
33
Quiz
4. What is the correct syntax of the declaration which defines the XML version?
34
Quiz
5. What does DTD stand for?
Dynamic Type Definition Do The Dance Direct Type Definition Document Type Definition
35
Quiz
6. Is this a "well formed" XML document?
<?xml version="1.0"?> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note>
Yes No
Answer : Yes
36
Quiz
7. Is this a "well formed" XML document?
<?xml version="1.0"?> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body>
Yes No
Answer : No
37
Quiz
8. Which statement is true?
All the statements are true All XML elements must be lower case All XML documents must have a DTD All XML elements must be properly closed
38
Quiz
9. Which statement is true?
All the statements are true XML elements must be properly nested XML tags are case sensitive XML documents must have a root tag
39
Quiz
10. XML preserves white spaces
False True
Answer : False
40
Quiz
11. Is this a "well formed" XML document?
<?xml version="1.0"?> <note> <to age="29">Tove</to> <from>Jani</from> </note>
No Yes
Answer : Yes
41
Quiz
12. Is this a "well formed" XML document?
<?xml version="1.0"?> <note> <to age=29>Tove</to> <from>Jani</from> </note>
Yes No
Answer : No
42
Quiz
13. XML elements cannot be empty
True False
Answer : False
43
Quiz
14. Which is not a correct name for an XML element?
Answer : <1dollar>
44
Quiz
15. Which is not a correct name for an XML element?
45
Quiz
16. Which is not a correct name for an XML element?
46