what is xml ?
DESCRIPTION
What is XML ?. e X tensible M arkup L anguage A subset of SGML (Standard Generalized Markup Language) Mechanism to identify structures in a document Markup language for documents containing structured information Self-Descriptive Buzz Word. XML and HTML. Similar in nature - PowerPoint PPT PresentationTRANSCRIPT
What is What is XMLXML??
eeXXtensible tensible MMarkup arkup LLanguageanguage A subset of SGML (Standard A subset of SGML (Standard
Generalized Markup Language)Generalized Markup Language) Mechanism to identify structures in a Mechanism to identify structures in a
documentdocument Markup language for documents Markup language for documents
containing structured informationcontaining structured information Self-DescriptiveSelf-Descriptive Buzz WordBuzz Word
XML and HTMLXML and HTML Similar in natureSimilar in nature <tags> <tags>
LabelsLabels ElementsElements
<tags> plus <tags> plus contentcontent Reference SpecificationReference Specification
WWW consortium (W3C)WWW consortium (W3C) HTML transitionalHTML transitional XHTMLXHTML XML 1.0XML 1.0
XML Document XML Document StructureStructure
DeclarationDeclaration ElementsElements AttributesAttributes Character DataCharacter Data Processing InstructionsProcessing Instructions CommentsComments Entity ReferencesEntity References
DeclarationDeclaration
<xml version=“1.0” encoding=“iso-8859-<xml version=“1.0” encoding=“iso-8859-1”>1”>
Start of the fileStart of the file OptionalOptional Future proofFuture proof
ElementsElements
<Report><Report>XML ReportXML Report
</Report></Report> Highest level termed as the root Highest level termed as the root
elementelement Contains:Contains:
Start tagStart tag Some ContentSome Content End tagEnd tag
AttributesAttributes
<Report <Report Author=“Stevie”Author=“Stevie”>>
XML ReportXML Report
</Report></Report> Contains:Contains:
NameName ValueValue
Character DataCharacter Data
<Report Author=“Stevie”><Report Author=“Stevie”>
<type>XML </type> Report<type>XML </type> Report
</Report></Report> Element ContentElement Content Special SymbolsSpecial Symbols
‘‘&’ and ‘<‘&’ and ‘<‘ See Entity ReferencesSee Entity References
CommentsComments
<!-- This is a Comment --><!-- This is a Comment -->
Entity ReferencesEntity References
EntityEntity CharacterCharacter
<< <<
>> >>
&& &&
'' ‘‘
"" ““
Processing InstructionsProcessing Instructions
<?, <?, and end with the stringand end with the string ?> ?> Show a processing instruction at the Show a processing instruction at the
appropriate place in the node tree appropriate place in the node tree (DOM)(DOM)
Firing a processing instruction event Firing a processing instruction event (SAX)(SAX)
Well-Formed XMLWell-Formed XML
Tags must be nested properlyTags must be nested properly All start tags must have end tagsAll start tags must have end tags Use quotation marks properly for Use quotation marks properly for
tag attributestag attributes Use entity referencesUse entity references
Document Type Document Type DefinitionDefinition
Set of rulesSet of rules May be included in the document May be included in the document
itselfitself May be linked externallyMay be linked externally Confirming to a DTDConfirming to a DTD
Well-formedWell-formed validvalid
Document Type Document Type DefinitionDefinition
** <!DOCTYPE rootElementName [<!DOCTYPE rootElementName [
……insert declarations here…insert declarations here…
]>]>
** <!Element <!Element element element ((sub1sub1, , sub2sub2,,…,…,subnsubn)>)>
** <!ATTLIST <!ATTLIST element name (value1|element name (value1|value2)value2)
XML ParsingXML Parsing
Document Object Model (DOM)Document Object Model (DOM) Simple API for XML (SAX)Simple API for XML (SAX)
Document Object Model Document Object Model ((DOMDOM))
Document Model drivenDocument Model driven Build a tree model of the elements in Build a tree model of the elements in
the documentthe document Allow for application to access the Allow for application to access the
treetree DOM XML parserDOM XML parser
Converts XML documents into Java Tree Converts XML documents into Java Tree object modelobject model
Simple API for XML Simple API for XML ((SAXSAX))
Event drivenEvent driven SAX XML parser processes elements SAX XML parser processes elements
seriallyserially XML application provides callback XML application provides callback
functions to handle elementsfunctions to handle elements
Freely Available XML Freely Available XML ParsersParsers
Apache Software Foundation Xerces Apache Software Foundation Xerces XML Parser (XML Parser (xml.apache.orgxml.apache.org)) Open sourceOpen source
Oracle XML Parser Version 2 (Oracle XML Parser Version 2 (www.oracle.com/xmlwww.oracle.com/xml)) Must registerMust register
SAX2 Parser (SAX2 Parser (www.megginsion.com/SAXwww.megginsion.com/SAX)) Freely availableFreely available
ReferencesReferences
http://www.w3.org/XMLhttp://www.w3.org/XML http://www.xml.comhttp://www.xml.com http://www.w3schools.com/xml/http://www.w3schools.com/xml/
default.aspdefault.asp