SlideShare a Scribd company logo
1 of 15
Prepared by
Dr.M.Kaliappan.,M.E.,Ph.D
Associate Professor
Dept. of Computer Science and Engineering
Ramco Institute of Technology
Rajapalayam, Tamilnadu, India
Email: kaliappan@ritrjpm.ac.in
Well-formed XML and valid XML
documents
Recap
Date: 08.07.2019
XML
XML delimiters characters:<?xml version=”1.0”?>
The XML document structure consists of
The XML declaration
The Document Type Declaration
The element data
The attribute data
The character data or XML content
Well-formed XML
• An XML document is well formed if it follows
all the preceding syntax rules of XML.
• On the other hand, if it includes inappropriate
markup that cannot be processed by XML
parsers, the document cannot be considered
well formed.
A well formed XML document for describe a T-shirt
<?xml version=”1.0”?>
<Tshirt>
<model> Zippy Tee </model>
<brand> Lee </brand>
<price currency= ”USD” >14.99</price>
<fabric content= ”60%” >cotton</fabric>
<fabric content= ”40%” >polyester</fabric>
<options>
<colorOptions>
<color>red</color>
<color>white</color>
</colorOptions>
<sizeOptions>
<size>Medium</size>
<size>Large</size>
</sizeOptions>
</options>
<description>
This is a sports giant brand
</description>
</Tshirt>
XML Declaration
Root element
Child element
Attribute
value
Valid XML documents
• A well-formed XML document is considered
valid only if it contains a proper Document
Type declaration and if the document obeys
the constraints of that declaration .
• The constraints of the declaration will be
expressed as a DTD or an XML Schema
Ex: Valid XML document : contactlist.xml
<?xml version=”1.0”?>
<!DOCTYPE contactlist SYSTEM “contactlist.dtd”>
<contactlist>
<fullname>Bobby Soninlaw</fullname>
<address>
<addressline1>101 South Street</addressline1>
<addressline2>Apartment #2</addressline2>
</address>
<phone>(405) 555-1234</phone>
<email>bs@mail.com</email>
</contactlist>
<!ELEMENT contactlist (fullname, address, phone, email) >
<!ELEMENT fullname (#PCDATA)>
<!ELEMENT address (addressline1, addressline2)>
<!ELEMENT addressline1 (#PCDATA)>
<!ELEMENT addressline2 (#PCDATA)>
<!ELEMENT phone (#PCDATA)>
<!ELEMENT email (#PCDATA)>
contactlist.dtd
Is this a “valid" XML document?contactlist.xml
<?xml version=”1.0”?>
<!DOCTYPE contactlist SYSTEM “contactlist.dtd”>
<contactlist>
<firstname>Bobby </firstname>
<fullname>Bobby Soninlaw</fullname>
<address>
<addressline1>101 South Street</addressline1>
<addressline2>Apartment #2</addressline2>
</address>
<phone>(405) 555-1234</phone>
<pincode>626125</pincode>
<email>bs@mail.com</email>
</contactlist>
<!ELEMENT contactlist (fullname, address, phone, email) >
<!ELEMENT fullname (#PCDATA)>
<!ELEMENT address (addressline1, addressline2)>
<!ELEMENT addressline1 (#PCDATA)>
<!ELEMENT addressline2 (#PCDATA)>
<!ELEMENT phone (#PCDATA)>
<!ELEMENT email (#PCDATA)>
contactlist.dtd
Well-Formed Document Valid XML Document
Well-formed documents follow all the
syntax rules of XML.
An XML document that conforms to
DTD or an XML Schema is said to be
valid XML document.
Not all well-formed XML documents
are valid XML document.
A valid XML document is also well-
formed.
Well-formed XML documents are
designed for use without any
constraints
Valid XML documents explicitly require
constraint mechanisms
It does not support advanced feature It support advanced features such as
linking mechanisms, value and range
bounding, and data typing
Difference between well-formed and valid" XML document
Class poll
1. Is this a "well formed" XML document?
<?xml version="1.0"?>
<message>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
2. Well formed XML document means
A. it contains a root element
B. it contain an element
C. it contains one or more elements
D. must contain one or more elements and root
element must contain all other elements
2. Valid XML document means (most appropriate)
A. the document has root element
B. the document contains at least one or more root
element
C. the XML document has DTD associated with it & it
complies with that DTD
D. Each element must nest inside any enclosing
element property
3. XML preserves white spaces
–True
–false
4. What does DTD stand for?
– Direct Type Definition
– Dynamic Type Definition
– Document Type Definition
5. How XML describe data
– XML uses a DTD to describe data
– XML uses a description node to describe data
– XML uses XSL to describe data
Exercise
• Create a valid xml document for students profile

More Related Content

What's hot (20)

SOA unit-3-notes-Introduction to Service Oriented Architecture
SOA unit-3-notes-Introduction to Service Oriented ArchitectureSOA unit-3-notes-Introduction to Service Oriented Architecture
SOA unit-3-notes-Introduction to Service Oriented Architecture
 
XML Schema
XML SchemaXML Schema
XML Schema
 
Xml
XmlXml
Xml
 
Xml 215-presentation
Xml 215-presentationXml 215-presentation
Xml 215-presentation
 
Xml ppt
Xml pptXml ppt
Xml ppt
 
Java script
Java scriptJava script
Java script
 
XML
XMLXML
XML
 
02 xml schema
02 xml schema02 xml schema
02 xml schema
 
Xml dtd- Document Type Definition- Web Technology
Xml dtd- Document Type Definition- Web TechnologyXml dtd- Document Type Definition- Web Technology
Xml dtd- Document Type Definition- Web Technology
 
Xml Presentation-3
Xml Presentation-3Xml Presentation-3
Xml Presentation-3
 
Xml
XmlXml
Xml
 
Software Engineering :UML class diagrams
Software Engineering :UML class diagramsSoftware Engineering :UML class diagrams
Software Engineering :UML class diagrams
 
XML
XMLXML
XML
 
XML
XMLXML
XML
 
XML Introduction
XML IntroductionXML Introduction
XML Introduction
 
Xslt
XsltXslt
Xslt
 
XSD
XSDXSD
XSD
 
Simple object access protocol(soap )
Simple object access protocol(soap )Simple object access protocol(soap )
Simple object access protocol(soap )
 
XQuery
XQueryXQuery
XQuery
 
1 xml fundamentals
1 xml fundamentals1 xml fundamentals
1 xml fundamentals
 

Similar to Soa unit-1-well formed and valid document08.07.2019

Similar to Soa unit-1-well formed and valid document08.07.2019 (20)

IT6801-Service Oriented Architecture- UNIT-I notes
IT6801-Service Oriented Architecture- UNIT-I notesIT6801-Service Oriented Architecture- UNIT-I notes
IT6801-Service Oriented Architecture- UNIT-I notes
 
M.FLORENCE DAYANA WEB DESIGN -Unit 5 XML
M.FLORENCE DAYANA WEB DESIGN -Unit 5   XMLM.FLORENCE DAYANA WEB DESIGN -Unit 5   XML
M.FLORENCE DAYANA WEB DESIGN -Unit 5 XML
 
Web Technologies Unit 2 Print.pdf
Web Technologies Unit 2 Print.pdfWeb Technologies Unit 2 Print.pdf
Web Technologies Unit 2 Print.pdf
 
Xml 1
Xml 1Xml 1
Xml 1
 
Unit 5 xml (1)
Unit 5   xml (1)Unit 5   xml (1)
Unit 5 xml (1)
 
Xml by Luqman
Xml by LuqmanXml by Luqman
Xml by Luqman
 
Xml
XmlXml
Xml
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Intro to xml
Intro to xmlIntro to xml
Intro to xml
 
Xml11
Xml11Xml11
Xml11
 
Xml Presentation-1
Xml Presentation-1Xml Presentation-1
Xml Presentation-1
 
chapter 4 web authoring unit 4 xml.pptx
chapter 4 web authoring  unit 4 xml.pptxchapter 4 web authoring  unit 4 xml.pptx
chapter 4 web authoring unit 4 xml.pptx
 
XML notes.pptx
XML notes.pptxXML notes.pptx
XML notes.pptx
 
Xml
XmlXml
Xml
 
Xml
XmlXml
Xml
 
XML-Unit 1.ppt
XML-Unit 1.pptXML-Unit 1.ppt
XML-Unit 1.ppt
 
XML.ppt
XML.pptXML.ppt
XML.ppt
 
Xml intro1
Xml intro1Xml intro1
Xml intro1
 
Xml
XmlXml
Xml
 
01 xml document structure
01 xml document structure01 xml document structure
01 xml document structure
 

More from Ramco Institute of Technology, Rajapalayam, Tamilnadu, India

More from Ramco Institute of Technology, Rajapalayam, Tamilnadu, India (19)

AD3251-Data Structures Design-Notes-Tree.pdf
AD3251-Data Structures  Design-Notes-Tree.pdfAD3251-Data Structures  Design-Notes-Tree.pdf
AD3251-Data Structures Design-Notes-Tree.pdf
 
AD3251-Data Structures Design-Notes-Searching-Hashing.pdf
AD3251-Data Structures  Design-Notes-Searching-Hashing.pdfAD3251-Data Structures  Design-Notes-Searching-Hashing.pdf
AD3251-Data Structures Design-Notes-Searching-Hashing.pdf
 
ASP.NET-stored procedure-manual
ASP.NET-stored procedure-manualASP.NET-stored procedure-manual
ASP.NET-stored procedure-manual
 
Neural networks using tensor flow in amazon deep learning server
Neural networks using tensor flow in amazon deep learning serverNeural networks using tensor flow in amazon deep learning server
Neural networks using tensor flow in amazon deep learning server
 
Mobile Computing-Unit-V-Mobile Platforms and Applications
Mobile Computing-Unit-V-Mobile Platforms and ApplicationsMobile Computing-Unit-V-Mobile Platforms and Applications
Mobile Computing-Unit-V-Mobile Platforms and Applications
 
CS8601 mobile computing Two marks Questions and Answer
CS8601 mobile computing Two marks Questions and AnswerCS8601 mobile computing Two marks Questions and Answer
CS8601 mobile computing Two marks Questions and Answer
 
Mobile computing Unit III MANET Notes
Mobile computing Unit III MANET NotesMobile computing Unit III MANET Notes
Mobile computing Unit III MANET Notes
 
Unit II -Mobile telecommunication systems
Unit II -Mobile telecommunication systemsUnit II -Mobile telecommunication systems
Unit II -Mobile telecommunication systems
 
Mobile computing unit-I-notes 07.01.2020
Mobile computing unit-I-notes 07.01.2020Mobile computing unit-I-notes 07.01.2020
Mobile computing unit-I-notes 07.01.2020
 
Virtual lab - Routing in Mobile Adhoc Networks
Virtual lab - Routing in Mobile Adhoc NetworksVirtual lab - Routing in Mobile Adhoc Networks
Virtual lab - Routing in Mobile Adhoc Networks
 
Flipped class collaborative learning-kaliappan-rit
Flipped class collaborative learning-kaliappan-ritFlipped class collaborative learning-kaliappan-rit
Flipped class collaborative learning-kaliappan-rit
 
Web services-Notes
Web services-NotesWeb services-Notes
Web services-Notes
 
Building Service Oriented Architecture based applications
Building Service Oriented Architecture based applicationsBuilding Service Oriented Architecture based applications
Building Service Oriented Architecture based applications
 
Innovative Practice-ZigSaw
Innovative Practice-ZigSaw Innovative Practice-ZigSaw
Innovative Practice-ZigSaw
 
Innovative practice -Three step interview-Dr.M.Kaliappan
Innovative practice -Three step interview-Dr.M.KaliappanInnovative practice -Three step interview-Dr.M.Kaliappan
Innovative practice -Three step interview-Dr.M.Kaliappan
 
Service Oriented Architecture-Unit-1-XML Schema
Service Oriented Architecture-Unit-1-XML SchemaService Oriented Architecture-Unit-1-XML Schema
Service Oriented Architecture-Unit-1-XML Schema
 
IT6801-Service Oriented Architecture-Unit-2-notes
IT6801-Service Oriented Architecture-Unit-2-notesIT6801-Service Oriented Architecture-Unit-2-notes
IT6801-Service Oriented Architecture-Unit-2-notes
 
Innovative Practice-Think-pair-share-Topic: DTD for TV schedule
Innovative Practice-Think-pair-share-Topic: DTD for TV scheduleInnovative Practice-Think-pair-share-Topic: DTD for TV schedule
Innovative Practice-Think-pair-share-Topic: DTD for TV schedule
 
Soa unit-1-xml namespaces 09.07.2019
Soa unit-1-xml namespaces 09.07.2019Soa unit-1-xml namespaces 09.07.2019
Soa unit-1-xml namespaces 09.07.2019
 

Recently uploaded

Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2RajaP95
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 

Recently uploaded (20)

Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 

Soa unit-1-well formed and valid document08.07.2019

  • 1. Prepared by Dr.M.Kaliappan.,M.E.,Ph.D Associate Professor Dept. of Computer Science and Engineering Ramco Institute of Technology Rajapalayam, Tamilnadu, India Email: kaliappan@ritrjpm.ac.in Well-formed XML and valid XML documents
  • 2. Recap Date: 08.07.2019 XML XML delimiters characters:<?xml version=”1.0”?> The XML document structure consists of The XML declaration The Document Type Declaration The element data The attribute data The character data or XML content
  • 3. Well-formed XML • An XML document is well formed if it follows all the preceding syntax rules of XML. • On the other hand, if it includes inappropriate markup that cannot be processed by XML parsers, the document cannot be considered well formed.
  • 4. A well formed XML document for describe a T-shirt <?xml version=”1.0”?> <Tshirt> <model> Zippy Tee </model> <brand> Lee </brand> <price currency= ”USD” >14.99</price> <fabric content= ”60%” >cotton</fabric> <fabric content= ”40%” >polyester</fabric> <options> <colorOptions> <color>red</color> <color>white</color> </colorOptions> <sizeOptions> <size>Medium</size> <size>Large</size> </sizeOptions> </options> <description> This is a sports giant brand </description> </Tshirt> XML Declaration Root element Child element Attribute value
  • 5. Valid XML documents • A well-formed XML document is considered valid only if it contains a proper Document Type declaration and if the document obeys the constraints of that declaration . • The constraints of the declaration will be expressed as a DTD or an XML Schema
  • 6. Ex: Valid XML document : contactlist.xml <?xml version=”1.0”?> <!DOCTYPE contactlist SYSTEM “contactlist.dtd”> <contactlist> <fullname>Bobby Soninlaw</fullname> <address> <addressline1>101 South Street</addressline1> <addressline2>Apartment #2</addressline2> </address> <phone>(405) 555-1234</phone> <email>bs@mail.com</email> </contactlist> <!ELEMENT contactlist (fullname, address, phone, email) > <!ELEMENT fullname (#PCDATA)> <!ELEMENT address (addressline1, addressline2)> <!ELEMENT addressline1 (#PCDATA)> <!ELEMENT addressline2 (#PCDATA)> <!ELEMENT phone (#PCDATA)> <!ELEMENT email (#PCDATA)> contactlist.dtd
  • 7. Is this a “valid" XML document?contactlist.xml <?xml version=”1.0”?> <!DOCTYPE contactlist SYSTEM “contactlist.dtd”> <contactlist> <firstname>Bobby </firstname> <fullname>Bobby Soninlaw</fullname> <address> <addressline1>101 South Street</addressline1> <addressline2>Apartment #2</addressline2> </address> <phone>(405) 555-1234</phone> <pincode>626125</pincode> <email>bs@mail.com</email> </contactlist> <!ELEMENT contactlist (fullname, address, phone, email) > <!ELEMENT fullname (#PCDATA)> <!ELEMENT address (addressline1, addressline2)> <!ELEMENT addressline1 (#PCDATA)> <!ELEMENT addressline2 (#PCDATA)> <!ELEMENT phone (#PCDATA)> <!ELEMENT email (#PCDATA)> contactlist.dtd
  • 8. Well-Formed Document Valid XML Document Well-formed documents follow all the syntax rules of XML. An XML document that conforms to DTD or an XML Schema is said to be valid XML document. Not all well-formed XML documents are valid XML document. A valid XML document is also well- formed. Well-formed XML documents are designed for use without any constraints Valid XML documents explicitly require constraint mechanisms It does not support advanced feature It support advanced features such as linking mechanisms, value and range bounding, and data typing Difference between well-formed and valid" XML document
  • 9. Class poll 1. Is this a "well formed" XML document? <?xml version="1.0"?> <message> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body>
  • 10. 2. Well formed XML document means A. it contains a root element B. it contain an element C. it contains one or more elements D. must contain one or more elements and root element must contain all other elements
  • 11. 2. Valid XML document means (most appropriate) A. the document has root element B. the document contains at least one or more root element C. the XML document has DTD associated with it & it complies with that DTD D. Each element must nest inside any enclosing element property
  • 12. 3. XML preserves white spaces –True –false
  • 13. 4. What does DTD stand for? – Direct Type Definition – Dynamic Type Definition – Document Type Definition
  • 14. 5. How XML describe data – XML uses a DTD to describe data – XML uses a description node to describe data – XML uses XSL to describe data
  • 15. Exercise • Create a valid xml document for students profile