Post on 06-Apr-2018
8/2/2019 BasicXML Presentation
1/46
1
Basic XML - Concepts
8/2/2019 BasicXML Presentation
2/46
Copy Right Reserved Satyam EAI Team 2
Our goals
What is XML?
XML Syntax Rules
XML Elements Naming Rules
XML Attributes
XML Validation
XML Related Technologies
XML Quiz
8/2/2019 BasicXML Presentation
3/46
3
What is XML?
8/2/2019 BasicXML Presentation
4/46
Copy Right Reserved Satyam EAI Team 4
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 owntags
XML is a W3C Recommendation (10. February 1998.)
8/2/2019 BasicXML Presentation
5/46
Copy Right Reserved Satyam EAI Team 5
What is XML?
Usage of XML XML is used to Exchange Data (widely used)
Data can be exchanged between incompatible systems.
Information can be exchanged over the Internet.
XML Can be Used to Store Data
8/2/2019 BasicXML Presentation
6/46
6
XML Syntax Rules
8/2/2019 BasicXML Presentation
7/46
Copy Right Reserved Satyam EAI Team 7
XML Syntax Rules
The syntax rules of XML are very simple and very strict.
Example:
Arun Prakash
12345
28
EAI
Tidel park
8
8/2/2019 BasicXML Presentation
8/46
Copy Right Reserved Satyam EAI Team 8
XML Syntax Rules
XML Document can have a XML declaration element
Defines the XML version and the character encoding usedin the document.
8/2/2019 BasicXML Presentation
9/46
Copy Right Reserved Satyam EAI Team 9
XML Syntax Rules
XML Documents Must Have a Root Element
Example:
8/2/2019 BasicXML Presentation
10/46
Copy Right Reserved Satyam EAI Team 10
XML Syntax Rules
Invalid XML without Root Element
Arun Prakash
1234528
EAI
Tidel park
8
8/2/2019 BasicXML Presentation
11/46
Copy Right Reserved Satyam EAI Team 11
XML Syntax Rules
XML Tags are Case Sensitive
Arun Prakash
1234528
8/2/2019 BasicXML Presentation
12/46
Copy Right Reserved Satyam EAI Team 12
XML Syntax Rules
XML Elements Must be Properly Nested
Arun Prakash
1234528
EAI
Tidel park
8
8/2/2019 BasicXML Presentation
13/46
Copy Right Reserved Satyam EAI Team 13
XML Syntax Rules
All XML Elements Must Have a Closing Tag
Arun Prakash
12345
8/2/2019 BasicXML Presentation
14/46
Copy Right Reserved Satyam EAI Team 14
XML Syntax Rules
Comments in XML
Arun Prakash
12345
28
EAI
Tidel park
8
8/2/2019 BasicXML Presentation
15/46
Copy Right Reserved Satyam EAI Team 15
XML Syntax Rules
With XML, the white space in your document is not truncated.
Arun Prakash12345
28
EAI
Tidel park Chennai
8
8/2/2019 BasicXML Presentation
16/46
Copy Right Reserved Satyam EAI Team 16
XML Syntax Rules
XML Element can have Empty Value
Sample :
or
8/2/2019 BasicXML Presentation
17/46
17
XML Elements Naming Rules
8/2/2019 BasicXML Presentation
18/46
Copy Right Reserved Satyam EAI Team 18
XML Elements Naming Rules
XML elements must follow these naming rules: 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
8/2/2019 BasicXML Presentation
19/46
Copy Right Reserved Satyam EAI Team 19
XML Elements Naming Rules
Some Examples:
XML Element Name Valid / Invalid Comments
Valid
Invalid Should not start with number
Valid Some special characters are allows
Invalid No spaces
Invalid Should not start with word xml / XML /
xML etc
Invalid Semi colon not allowed
Valid No restriction on element length
8/2/2019 BasicXML Presentation
20/46
20
XML Attributes
8/2/2019 BasicXML Presentation
21/46
Copy Right Reserved Satyam EAI Team 21
XML Attributes
elementValue
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)
8/2/2019 BasicXML Presentation
22/46
Copy Right Reserved Satyam EAI Team 22
XML Attributes
Example:
Arun Prakash
Tidel park
8
8/2/2019 BasicXML Presentation
23/46
23
XML Validation
8/2/2019 BasicXML Presentation
24/46
Copy Right Reserved Satyam EAI Team 24
XML Validation
Well Formed XML Documents A "Well Formed" XML document has correct XML syntax.
A "Well Formed" XML document is a document that conforms tothe 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
8/2/2019 BasicXML Presentation
25/46
Copy Right Reserved Satyam EAI Team 25
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 structuredefined in DTD or XML Schema (more about it later) thenaming syntax rules
8/2/2019 BasicXML Presentation
26/46
26
XML Related Technologies
8/2/2019 BasicXML Presentation
27/46
Copy Right Reserved Satyam EAI Team 27
XML Related Technologies
XHTML (Extensible HTML) is a stricter and cleanerversion of HTML.
XSL (Extensible Style Sheet Language) - XSL consists ofthree parts
XSLT (XSL Transformations)- a language for transforming XMLdocuments
XPath - a language for navigating in XML documents
XSL-FO (Formatting Objects) - a language for formatting XMLdocuments.
8/2/2019 BasicXML Presentation
28/46
Copy Right Reserved Satyam EAI Team 28
XML Related Technologies
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 overHTTP.
8/2/2019 BasicXML Presentation
29/46
Copy Right Reserved Satyam EAI Team 29
XML Related Technologies
WSDL (Web Services Description Language) is an XML-based language for describing web services.
XLink (XML Linking Language) is a language for creatinghyperlinks in XML documents.
XPointer (XML Pointer Language) allows the XLinkhyperlinks to point to more specific parts in the XMLdocument.
8/2/2019 BasicXML Presentation
30/46
30
Quiz
8/2/2019 BasicXML Presentation
31/46
Copy Right Reserved Satyam EAI Team 31
Quiz
1.What does XML stand for? eXtensible Markup Language
X-Markup Language
Example Markup Language
Xtra Modern Link
Answer : eXtensible Markup Language
8/2/2019 BasicXML Presentation
32/46
Copy Right Reserved Satyam EAI Team 32
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
Answer :XML uses a DTD to describe the data
8/2/2019 BasicXML Presentation
33/46
Copy Right Reserved Satyam EAI Team 33
Quiz
3. XML's goal is to replace HTML False
True
Answer : False
8/2/2019 BasicXML Presentation
34/46
Copy Right Reserved Satyam EAI Team 34
Quiz
4.What is the correct syntax of the declaration which definesthe XML version?
Answer :
8/2/2019 BasicXML Presentation
35/46
Copy Right Reserved Satyam EAI Team 35
Quiz
5.What does DTD stand for? Dynamic Type Definition
Do The Dance
Direct Type Definition
Document Type Definition
Answer : Document Type Definition
8/2/2019 BasicXML Presentation
36/46
Copy Right Reserved Satyam EAI Team 36
Quiz
6. Is this a "well formed" XML document?
Tove
Jani
Reminder
Don't forget me this weekend!
Yes
No
Answer : Yes
8/2/2019 BasicXML Presentation
37/46
Copy Right Reserved Satyam EAI Team 37
Quiz
7. Is this a "well formed" XML document?
Tove
Jani
Reminder
Don't forget me this weekend!
Yes
No
Answer : No
8/2/2019 BasicXML Presentation
38/46
Copy Right Reserved Satyam EAI Team 38
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
Answer : All XML elements must be properly closed
8/2/2019 BasicXML Presentation
39/46
Copy Right Reserved
Satyam EAI Team 39
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
Answer: All the statements are true
8/2/2019 BasicXML Presentation
40/46
Copy Right Reserved
Satyam EAI Team 40
Quiz
10. XML preserves white spaces False
True
Answer : False
8/2/2019 BasicXML Presentation
41/46
Copy Right Reserved
Satyam EAI Team 41
Quiz
11. Is this a "well formed" XML document?
Tove
Jani
No
Yes
Answer : Yes
8/2/2019 BasicXML Presentation
42/46
Copy Right Reserved
Satyam EAI Team 42
Quiz
12. Is this a "well formed" XML document?
Tove
Jani
Yes
No
Answer : No
8/2/2019 BasicXML Presentation
43/46
Copy Right Reserved
Satyam EAI Team 43
Quiz
13. XML elements cannot be empty True
False
Answer : False
8/2/2019 BasicXML Presentation
44/46
Copy Right Reserved
Satyam EAI Team 44
Quiz
14.Which is not a correct name for an XML element?
All 3 names are incorrect
Answer :
8/2/2019 BasicXML Presentation
45/46
Copy Right Reserved
Satyam EAI Team 45
Quiz
15.Which is not a correct name for an XML element? All 3 names are incorrect
Answer :
8/2/2019 BasicXML Presentation
46/46
Quiz
16.Which is not a correct name for an XML element? All 3 names are incorrect
Answer : All 3 names are incorrect