SlideShare a Scribd company logo
Unit 1
Fundamentals of XML
XML Document Structure
• XML declaration
• Document type declaration
• Element data
• Attribute data
• Character data/XML content
Xml declaration
Components:
• <?xml
• Version=“1.0”
• Standalone =“yes/no”
• Encoding=“US-ASCII”
Document type declaration(DOCTYPE)
• Link to DTD
• General forms:
– <!DOCTYPE NAME SYSTEM “file”>
– <!DOCTYPE NAME []>
– <!DOCTYPE NAME SYSTEM “file” []>
Components
• <
• !DOCTYPE
• NAME
• SYSTEM
• “file”
• [
• ]
• >
Markup and content
Six kinds of markup in XML document:
• Elements
• Entity references
• Comments
• Processing instruction
• Marked section
• Document Type Definition
Elements
• A matched pair of XML tags
<shirt> ….. </shirt>
• Single XML tags with ‘self-closing’/empty
element
<shirt/>
• Nested elements
Rules for element name
• Element name can contain letters, numbers,
other characters
• No start with a number or punctuation character
• No white space inbetween words
<this_is_really_long_element_name>
• no name as xml or with colon
• Should be descriptive, not confusing.
• Avoid hyphen(-) and dot(.)
Attributes
• Additional information about element
• Eg:
<price currency=“USD”>….</price>
<on_sale start_date=“10.5.2001”/>
• In DTD, attribute can be required, optional, fixed
and enumerated.
• Eg:
<shirt><color>red</color></shirt>
Or <shirt color=“red”/>
Entity reference
• Symbols referred by name
• Starts with ampersand and ends with
semicolon.
• Eg: <element> 4 &gt; 2</element>
• Types: internal entity & external entity
Comments & PI
• <!-- comments lines -->
• PI(processing Instruction) same as comments.
• Information about how the content should be
processed.
• <?instruction options?>
• PI target
• Eg: <?send message “process completed”?>
Marked CDATA section
• Character data/CDATA section
• Instructs parser to ignore all markup like
elements, entity, PI,…
• All passed as string.
• <![CDATA[content]]>
DTD
• Validate the documents.
• Well defined rules for document structure and
content.
XML content
• Content between the elements
• Can consist any data
• Can be long ie.100MB
XML content model
• 3 types: open, closed & mixed.
• Open: can add elements & attributes without
declaration in DTD or XML schema.
• Closed: restricts elements and attributes to
only those that are specified in the DTD or
schema.
• Mixed
Handling whitespace
• Character spaces, tabs, linefeeds, and carriage
returns in documents.
• Whitespace is significant is by knowing the
content model of the XML document .
• Mixed-significant
• Open/closed-not significant
• Special attribute:- xml:space with 2
values:perserve/default
fundamentals of XML
Rules of XML structure
Rule 1:All XML elements must have a closing tag.
Eg: <markup>This is not valid XML
<markup>Since there is no closing tag.
Rule 2:XML tags are case sensitive.
Eg: <Markup>These two tags are very
different</markup>
Rules of XML structure
Rule 3:All XML Elements Must Have Proper
Nesting.
Eg:<oxygen><nitrogen>These tags are
improperly nested</oxygen></nitrogen>
Rule 4: All XML Documents Must Contain a
Single Root Element.
fundamentals of XML
Rules of XML structure
Rule 5:Attribute Values Must Be Quoted.
Eg:
<?xml version=1.0?>
<shirt>
<price currency=USD>14.99</price>
</shirt>
Rules of XML structure
Rule 6:Attributes May Only Appear Once in the
Same Start Tag
Eg: shirt size=”large” size=”small”>Zippy Tee
</shirt>
Rule 7: Attribute Values Cannot Contain References
to External Entities
Rule 8:All Entities Except amp, lt, gt, apos, and quot
Must Be Declared Before They Are Used
Eg: &amp; , &lt;,&gt;, &apos;, &qout;
fundamentals of XML
Well formed and valid document
• a valid XML document is a more strict form of
a well-formed XML document .
• well formed if it follows all the preceding
syntax rules of XML.
• valid XML documents can improve the quality
of document processes.
Linking XML document
• Xlink
• Xpointer
Namespace
• Method to avoid the name conflict.
• Namespaces use a colon-delimited prefix to
associate external semantics with elements
that can be identified via a Universal
Resource Identifier (URI).
Example
• <Customer>
<Name>John Smith</Name>
</Customer>
• <Product>
<Name>Hot Dog Buns</Name>
</Product>
Example
• <Customer>
<Name>John Smith</Name>
<Order>
<Product>
<Name>Hot Dog Buns</Name>
</Product>
</Order>
</Customer>
Example
• <Customer>
<cust:Name xmlns:cust=”customer-namespace-
URI”>John Smith</cust:Name>
<cust:Order>
<prod:Product xmlns:prod=”product-namespace-
URI”>
<prod:Name >Hot Dog Buns</prod:Name>
</prod:Product>
</cust:Order>
</cust:Customer>
Default namespace
• <Customer xmlns=”http://www.eps-
software.com/po”>
<Name>Travis Vandersypen</Name>
<Order>
<Product>
<Name>Hot Dog Buns</Name>
</Product>
</Order>
</Customer>
Example
• <po:Customer xmlns:po=”http://www.eps-
software.com/po”>
<po:Name>Travis Vandersypen</po:Name>
<po:Order>
<po:Product>
<po:Name>Hot Dog Buns</po:Name>
</po:Product>
</po:Order>
</po:Customer>
Multiple namespaces
<cust:Customer xmlns:cust=”http://www.eps-
software.com/customer”
xmlns:ord=”http://www.eps-software.com/order”>
<cust:Name>Travis Vandersypen</cust:Name>
<ord:Order>
<ord:Product>
<prod:Name xmlns:prod=”product-namespace-
URI”>Hot Dog Buns</ord:Name>
</ord:Product>
</ord:Order>
</cust:Customer>
Inheriting
<Customer xmlns=”http://www.eps-
software.com/customer”>
<Name>Travis Vandersypen</Name>
<Order xmlns=”http://www.eps-
software.com/order”>
<Product>
<Name>Hot Dog Buns</Name>
</Product>
</Order>
</Customer>

More Related Content

PPTX
PPTX
Xml namespace
PPTX
Web services protocols
PPT
Xml Presentation-3
PPT
DOM and SAX
PPT
Class 5 - PHP Strings
PPTX
MDF and LDF in SQL Server
Xml namespace
Web services protocols
Xml Presentation-3
DOM and SAX
Class 5 - PHP Strings
MDF and LDF in SQL Server

What's hot (20)

PPT
Css lecture notes
PPTX
XML Schema
PPT
Xpath.ppt
PPTX
HTML Forms
PPT
XSLT.ppt
PPTX
Dom(document object model)
PPTX
Html multimedia tag
PPTX
Dynamic HTML (DHTML)
PPT
10. XML in DBMS
PDF
Javascript essentials
PPTX
XSLT presentation
PPT
Introduction to CSS Borders - Lesson 4
PPTX
Ch 7 data binding
PDF
Android Networking
PPT
XML Schema
PDF
PPTX
PPT
Introduction to Javascript
Css lecture notes
XML Schema
Xpath.ppt
HTML Forms
XSLT.ppt
Dom(document object model)
Html multimedia tag
Dynamic HTML (DHTML)
10. XML in DBMS
Javascript essentials
XSLT presentation
Introduction to CSS Borders - Lesson 4
Ch 7 data binding
Android Networking
XML Schema
Introduction to Javascript
Ad

Similar to fundamentals of XML (20)

PPTX
PDF
Introduction to XML
PDF
M.FLORENCE DAYANA WEB DESIGN -Unit 5 XML
PPTX
Unit 5 xml (1)
PPT
XML-Unit 1.ppt
PPT
PDF
xml introduction in web technologies subject
PPT
1 xml fundamentals
PPTX
XML, DTD & XSD Overview
PPT
Ch2 neworder
PPT
Introduction to xml
PPTX
Web Development Course - XML by RSOLUTIONS
PDF
XML
PPT
XML Presentation-2
PPTX
XML notes.pptx
PPTX
Internet_Technology_UNIT V- Introduction to XML.pptx
DOCX
Xml viva questions
PPTX
PPT
web program-Extended MARKUP Language XML.ppt
Introduction to XML
M.FLORENCE DAYANA WEB DESIGN -Unit 5 XML
Unit 5 xml (1)
XML-Unit 1.ppt
xml introduction in web technologies subject
1 xml fundamentals
XML, DTD & XSD Overview
Ch2 neworder
Introduction to xml
Web Development Course - XML by RSOLUTIONS
XML
XML Presentation-2
XML notes.pptx
Internet_Technology_UNIT V- Introduction to XML.pptx
Xml viva questions
web program-Extended MARKUP Language XML.ppt
Ad

More from hamsa nandhini (19)

PPTX
SOA - Unit 5 - SOA and Business Process Management
PPTX
SOA - Unit 4 - SOA & Web Services for integration and Multi-Channel access
PPTX
SOA - Unit 3 - SOA and Web Services
PPTX
SOA - Unit 2 - Service Oriented Architecture
PPTX
SOA - Unit 1 - Introduction to SOA with Web Services
PPTX
NP - Unit 5 - Bootstrap, Autoconfigurion and BGP
PPTX
NP - Unit 4 - Routing - RIP, OSPF and Internet Multicasting
PPTX
NP - Unit 3 - Forwarding Datagram and ICMP
PPTX
NP - Unit 2 - Internet Addressing, ARP and RARP
PPTX
PPTX
Web application, cookies and sessions
PPTX
PHP with MySQL
PPTX
Database design and error handling
PPTX
Introduction to MySQL in PHP
PPTX
Basics of PHP
PPTX
XML Security
PPTX
SOAP and Web services
PPTX
XML Technologies
PPTX
XML DTD and Schema
SOA - Unit 5 - SOA and Business Process Management
SOA - Unit 4 - SOA & Web Services for integration and Multi-Channel access
SOA - Unit 3 - SOA and Web Services
SOA - Unit 2 - Service Oriented Architecture
SOA - Unit 1 - Introduction to SOA with Web Services
NP - Unit 5 - Bootstrap, Autoconfigurion and BGP
NP - Unit 4 - Routing - RIP, OSPF and Internet Multicasting
NP - Unit 3 - Forwarding Datagram and ICMP
NP - Unit 2 - Internet Addressing, ARP and RARP
Web application, cookies and sessions
PHP with MySQL
Database design and error handling
Introduction to MySQL in PHP
Basics of PHP
XML Security
SOAP and Web services
XML Technologies
XML DTD and Schema

Recently uploaded (20)

PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPT
Project quality management in manufacturing
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
additive manufacturing of ss316l using mig welding
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
web development for engineering and engineering
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
Welding lecture in detail for understanding
PPTX
Construction Project Organization Group 2.pptx
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
Project quality management in manufacturing
Automation-in-Manufacturing-Chapter-Introduction.pdf
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Embodied AI: Ushering in the Next Era of Intelligent Systems
CYBER-CRIMES AND SECURITY A guide to understanding
additive manufacturing of ss316l using mig welding
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
UNIT 4 Total Quality Management .pptx
Lecture Notes Electrical Wiring System Components
web development for engineering and engineering
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Welding lecture in detail for understanding
Construction Project Organization Group 2.pptx

fundamentals of XML