REPORT. XML Document?. ANS: XML (Extensible Markup Lang

Added on - Sep 2019

Trusted by 2+ million users,
1000+ happy students everyday
Showing pages 1 to 3 of 6 pages
REPORTXML Document?ANS: XML (Extensible Markup Language). It is a language which was designed to transport the data andto store the data. It composed of elements and other markup code. One element can contain some otherelement. Along with element, markup it may contain some other like comment and processingInstruction.It consists of following elements:• XML Declaration• Document Type Declaration (DTD)• BodyXML Declaration:It is a piece of code which is used to identify this an XML document which mayinclude version and encoding schemeDocument Type Declaration (DTD):DTD follows the xml document. It is used to validate the xmldocument. It contains some set of rules defined by the user.Body:Body contains the xml code which defines what this code is supposed to do. It works with the helpof element that element may contains some further element or may be some other informationWhat is Document Type Declaration?ANS: A Document type Definition contains some legal set of blocks that defines the structure of XMLdocument. A DTD can be declared inside an XML document or can be declared in some other separatefile based on its use naming is provided as Internal DTD or External DTDXML Document with an internal DTD
<?xml version="1.0"?><!DOCTYPE note [<!ELEMENT note (to,from,heading,body)><!ELEMENT to (#PCDATA)><!ELEMENT from (#PCDATA)><!ELEMENT heading (#PCDATA)><!ELEMENT body (#PCDATA)>]><note><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don't forget me this weekend</body></note>Where DOCTYPE note is use to represent the root element of the document,• Element note is also element of the root, this can be treated as the child of the root element currently itis representing the four other different element which is to, from, heading, body,• Element to defines the element of the type which can accept the data of type #PCDATA means that itcan accept the data of type String• Element from is another element of the root element which also accept the of type #PCDATA
• Element heading is the element of the root which represent the heading of the root element• Element body is one another kind of element of the root element which also accept the type of#PCDATALike in our Project we have use <?XML version="1.0" encoding=" UTF-8"?> declaration indicates thatXML is of version 1 and it is using UTF-8 encoding scheme in the next upcoming line it is showing thatthis XML document is used to provide web stylesheetNow the body of the XML starts here which contain top most element carAccessoriesShop whichcontains further two elements first one is shopDetail and second one is carAccessories. First elementshopDetail is used to provide the description of that shop and carAccessories is use to provide the detailsof car type. ShopDetail may contain further some element where each element is used to provide thedetail of the shop like shopName, address, telephone, website, Image. shopName element represents thename of the shop; the address is use to represent the address of that shop, telephone contains the numberof that businessman, the website provides the link of the website, the image is used to represent the logoof the business. Whatever rule we have discussed above is similarly explained in the DTD Document like<!ELEMENT carAccessoriesShop (shopDetail,carAccessories)> where carAccessoriesShop is containedtwo more element shopDetail, and carAccessories like that shopDetail contain further some other elementone of them is <!ELEMENT shopName (#PCDATA)> here shopName is one another element which canaccept the value in XML and #PCDATA is telling what kind of value it can accept here it can acceptString type of value.In the second element of carAccessingShop <carAccessories> is used in that some other 10 group ofelement and because it is more than one like this <!ELEMENT carAccessories (item+)> so we writeitem+ but if there is just 1 item we don’t need to mention it like in above case then in each item we needto specify what kind of item it is like the first item is given as <item type="batteryChargers"> in each data
Desklib Logo
You are reading a preview
Upload your documents to download or

Become a Desklib member to get access