E N D
XML WithTeacherSachin Zurange VISIONACADEMY(BCA,BBA(CA),BCS,MCA)
WHATISXML? • XMLstandsforExtensibleMarkupLanguage • XMLisamarkuplanguagemuchlikeHTML • XMListext-basedmarkuplanguagethatenablesto storedata • instructureformatbyusingmeaningfultags. • XMLtagsarenotpredefined.Youmustdefineyour owntags • XMLisdesignedtobeself-descriptive • XMLisaW3C(WorldWideWebConsortium Recommendation
FeatureofXML 1.XMLSeparatesDatafromHTMLifyouneedtodisplaydynamicdatainyourHTML document,itwilltakealotofworktoedittheHTMLeachtimethedatachanges.With XML,datacanbestoredinseparateXMLfiles. ThiswayyoucanconcentrateonusingHTML/CSSfordisplayandlayout,andbesure thatchangesintheunderlyingdatawillnotrequireanychangestotheHTML. WithafewlinesofJavaScriptcode,youcanreadanexternalXMLfileandupdatethe datacontentofyourwebpage. 2XMLSimplifiesDataSharingIntherealworld,computersystemsand atabasescontaindatainincompatibleformats.XMLdataisstoredinplain textformat.Thisprovidesasoftwareandhardware-independentwayof storingdata.Thismakesitmucheasiertocreatedatathatcanbeshared bydifferentapplications.
XMLDOCUMENTSTRUCTUREORCOMPONENENTOFXML XMLDECLARATION XML declaration contains details that prepare an XML processor to parse the XML document. It is optional, but when used,itmustappearinthefirstlineofthe XML document. <?xml version = "version_number" encoding = "encoding_declaration"?> It defines the XML version (1.0) and the encodinginformationsuch asISO-8859- 1,UTF-8,UTF-16 e.g <?xmlversion="1.0"encoding="ISO- 8859-1"?> • DOCUMENT PROLOGSECTION • Document Prolog comes at the topofthedocument,beforethe root element. This section contains− • XMLdeclaration • Documenttypedeclaration
DocumentElementsSection • DOCUMENTELEMENTSARETHEBUILDINGBLOCKSOFXML.ELEMENTSCAN BEHAVEASCONTAINERSTOHOLDTEXT,ELEMENTS,ATTRIBUTESETC • <ELEMENT-NAMEATTRIBUTE1ATTRIBUTE2>....CONTENT</ELEMENT- NAME> • ELEMENT-NAMEISTHENAMEOFTHEELEMENT.THENAMEITSCASEIN THESTARTANDENDTAGSMUSTMATCH. • AMARKUPCONSTRUCTTHATBEGINSWITH<ANDENDSWITH>.TAGS COMEINTHREEWAYS • START-TAGS;FOREXAMPLE:<SECTION> • END-TAGS;FOREXAMPLE:</SECTION> • EMPTY-ELEMENTTAGS;FOREXAMPLE:<SECTION/> • ATTRIBUTE1,ATTRIBUTE2AREATTRIBUTESOFTHEELEMENTSEPARATED BYWHITESPACES.ANATTRIBUTEDEFINESAPROPERTYOFTHEELEMENT. IT ASSOCIATES A NAME WITH A VALUE, WHICH IS A STRING OF CHARACTERS.ANATTRIBUTEISWRITTENASNAME=”VALUE”
XMLSYNTAXRULES 1 AllXMLElementsMust Have aClosingTag InHTML,someelementsdo not havetohaveaclosingtag: <p>Thisisaparagraph.InXML,itisillegaltoomit theclosingtag.Allelements musthaveaclosingtag:<p>Thisisaparagraph.</p> XMLTagsareCaseSensitive XMLtagsarecasesensitive.Thetag<Letter>isdifferentfrom the tag<letter>.Opening andclosing tagsmustbewrittenwiththesamecase:<Message>Thisisincorrect</message> <message>Thisiscorrect</message> XMLElementsMustbeProperlyNested In HTML,youmightseeimproperlynestedelements:<b><i>Thistextisboldanditalic</b></i> InXML,allelementsmustbeproperlynestedwithineachother:<b><i>Thistextisboldand italic</i></b XMLDocumentsMust Have aRootElement XMLdocumentsmustcontainoneelementthatis theparent of allotherelements.Thiselementiscalled the rootelement.<root> <child> <subchild>.....</subchild> </child> </root>
XML2typeofreference EntityReferences: SomecharactershaveaspecialmeaninginXML.Ifyouplaceacharacterlike"<"insideanXML element,itwillgenerateanerrorbecause theparserinterpretsitas the start ofanewelement. CharacterReferences: AcharacterreferencegivesthenumberoftheparticularUnicode characteritstandsfor,ineitherdecimalorhexadecimal. Decimalcharacterreferenceslooklike&#hexadecimalcharacterreferences haveanextraxafterthe&#&#;,thatis,theylooklike&#
APPLICATIONOFXML Webpublishing XMLallowsthedeveloperstosavethedataintoXMLfiles&useXSLT transformation API’StogeneratecontentintherequiredformatsuchasHTML,XHTML WebSearching ItcanuseXMLdata&thensearchthedatafromtheXMLfile&displayitto theuser DataTransfer ItcanuseXMLtosaveconfigurationorbusinessdataforourapplication CreatedOtherlanguages ManylanguagearecreatedusingXMLsuchasWML
QUESTIONS? CLARIFICATIONS? EmailAddress sachin.zurange@gmail.com Pleasefeelfreetocontactme, TeacherSachinZurangethroughemailorphone. MobileNumber (9822506209/9823037693) ConsultationHours 4PMto6PM