XML e X tensible M arkup L anguage (XML) By: Subhadeep Samantaray.

Slides:



Advertisements
Similar presentations
XML-XSL Introduction SHIJU RAJAN SHIJU RAJAN Outline Brief Overview Brief Overview What is XML? What is XML? Well Formed XML Well Formed XML Tag Name.
Advertisements

1 eXtensible Markup Language. XML is based on SGML: Standard Generalized Markup Language HTML and XML are both based on SGML 2 SGML HTMLXML.
J0 1 Marco Ronchetti - Web architectures – Laurea Specialistica in Informatica – Università di Trento Java XML parsing.
XML Schema Heewon Lee. Contents 1. Introduction 2. Concepts 3. Example 4. Conclusion.
What is XML? a meta language that allows you to create and format your own document markups a method for putting structured data into a text file; these.
XML: Extensible Markup Language
SPECIAL TOPIC XML. Introducing XML XML (eXtensible Markup Language) ◦A language used to create structured documents XML vs HTML ◦XML is designed to transport.
An Introduction to XML Based on the W3C XML Recommendations.
INF201 Fall2010 Intro. to Info. Technologies Department of Informatics University at Albany – SUNY Original Source: w3schools.com Prepared by Xiao Liang,
IS 373—Web Standards Todd Will
Sistemi basati su conoscenza XML Prof. M.T. PAZIENZA a.a
Sistemi basati su conoscenza XML Prof. M.T. PAZIENZA a.a
XML(EXtensible Markup Language). XML XML stands for EXtensible Markup Language. XML is a markup language much like HTML. XML was designed to describe.
Tutorial 11 Creating XML Document
Introduction to XML: Yong Choi CSU Bakersfield.
Introduction to XML Rashmi Kukanur. XML XML stands for Extensible Markup Language XML was designed to carry data XML and HTML designed with different.
Introduction to XML This material is based heavily on the tutorial by the same name at
ECA 228 Internet/Intranet Design I Intro to XML. ECA 228 Internet/Intranet Design I HTML markup language very loose standards browsers adjust for non-standard.
Pemrograman Berbasis WEB XML part 2 -Aurelio Rahmadian- Sumber: w3cschools.com.
XML introduction to Ahmed I. Deeb Dr. Anwar Mousa  presenter  instructor University Of Palestine-2009.
XML Anisha K J Jerrin Thomas. Outline  Introduction  Structure of an XML Page  Well-formed & Valid XML Documents  DTD – Elements, Attributes, Entities.
What is XML? XML stands for EXtensible Markup Language
Introduction to XML cs3505. References –I got most of this presentation from this site –O’reilly tutorials.
1 XML at a neighborhood university near you Innovation 2005 September 16, 2005 Kwok-Bun Yue University of Houston-Clear Lake.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
Pemrograman Berbasis WEB XML -Aurelio Rahmadian- Sumber: w3cschools.com.
XML eXtensible Markup Language w3c standard Why? Store and transport data Easy data exchange Create more languages WSDL (Web Service Description Language)
XML What is XML? XML v.s. HTML XML Components Well-formed and Valid Document Type Definition (DTD) Extensible Style Language (XSL) SAX and DOM.
1 © Netskills Quality Internet Training, University of Newcastle Introducing XML © Netskills, Quality Internet Training University.
Introduction to XML. What is XML? Extensible Markup Language XML Easier-to-use subset of SGML (Standard Generalized Markup Language) XML is a.
What is XML?  XML stands for EXtensible Markup Language  XML is a markup language much like HTML  XML was designed to carry data, not to display data.
These Questions are copied from
Introduction to XML Extensible Markup Language. What is XML XML stands for eXtensible Markup Language. A markup language is used to provide information.
 XML is designed to describe data and to focus on what data is. HTML is designed to display data and to focus on how data looks.  XML is created to structure,
XML TUTORIAL Portions from w3 schools By Dr. John Abraham.
Electronic Commerce COMP3210 Session 4: Designing, Building and Evaluating e-Commerce Initiatives – Part II Dr. Paul Walcott Department of Computer Science,
Avoid using attributes? Some of the problems using attributes: Attributes cannot contain multiple values (child elements can) Attributes are not easily.
How do I use HTML and XML to present information?.
XML eXtensible Markup Language. Topics  What is XML  An XML example  Why is XML important  XML introduction  XML applications  XML support CSEB.
Softsmith Infotech XML. Softsmith Infotech XML EXtensible Markup Language XML is a markup language much like HTML Designed to carry data, not to display.
Consuming eXtensible Markup Language (XML) feeds.
Introduction to XML This presentation covers introductory features of XML. What XML is and what it is not? What does it do? Put different related technologies.
XML Instructor: Charles Moen CSCI/CINF XML  Extensible Markup Language  A set of rules that allow you to create your own markup language  Designed.
XML EXtensible Markup Language. Agenda Introduction to XML XML Rules XML Elements XML Attributes XML Validation XML Exercises XML Namespaces XML CDATA.
School of Computing and Information Systems CS 371 Web Application Programming XML and JSON Encoding Data.
An Introduction to XML Sandeep Bhattaram
XML Introduction. What is XML? XML stands for eXtensible Markup Language XML stands for eXtensible Markup Language XML is a markup language much like.
What it is and how it works
1 XML eXtensible Markup Language. 2 XML vs. HTML HTML is a HyperText Markup language HTML is a HyperText Markup language Designed for a specific application,
XML Introduction. Markup Language A markup language must specify What markup is allowed What markup is required How markup is to be distinguished from.
1 Indexing The syntax for creating a index is: CREATE [UNIQUE] INDEX index_name ON table_name (column1, column2,... column_n) [ COMPUTE STATISTICS ]; Why.
XML and SAX (A quick overview) ● What is XML? ● What are SAX and DOM? ● Using SAX.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2.
+ 1 XML eXtensible Markup Language. + 2 XML Lecture Adapted from the work of Dr. Praveen Madiraju of Marquette University.
When we create.rtf document apart from saving the actual info the tool saves additional info like start of a paragraph, bold, size of the font.. Etc. This.
ASHIMA KALRA  INTRODUCTION OF XML INTRODUCTION OF XML  XML FEATURES XML FEATURES  XML SYNTAX XML SYNTAX  XML ELEMENTS XML ELEMENTS  XML ATTRIBUTES.
Introduction to DTD A Document Type Definition (DTD) defines the legal building blocks of an XML document. It defines the document structure with a list.
XML CSC1310 Fall HTML (TIM BERNERS-LEE) HyperText Markup Language  HTML (HyperText Markup Language): December  Markup  Markup is a symbol.
7-Mar-16 Simple API XML.  SAX and DOM are standards for XML parsers-- program APIs to read and interpret XML files  DOM is a W3C standard  SAX is an.
 XML derives its strength from a variety of supporting technologies.  Structure and data types: When using XML to exchange data among clients, partners,
XML – Basic Concepts (modified version from Dr. Praveen Madiraju) 2015, Fall Pusan National University Ki-Joune Li.
XML Introduction to XML Extensible Markup Language.
XML Notes taken from w3schools. What is XML? XML stands for EXtensible Markup Language. XML was designed to store and transport data. XML was designed.
1 XML eXtensible Markup Language. 2 Introduction and Motivation Dr. Praveen Madiraju Modified from Dr.Sagiv’s slides.
Extensible Markup Language (XML) Pat Morin COMP 2405.
XML intro. What is XML? XML stands for EXtensible Markup Language XML is a markup language much like HTML XML was designed to carry data, not to display.
XML BASICS and more…. What is XML? In common:  XML is a standard, simple, self-describing way of encoding both text and data so that content can be processed.
Unit 4 Representing Web Data: XML
What is XML?.
XML Parsers.
Presentation transcript:

XML e X tensible M arkup L anguage (XML) By: Subhadeep Samantaray

Introduction A subset of SGML (Standard Generalized Markup Language) A markup language much like HTML Stands for Extensible Markup Language Bridge for data exchange on the Web Used to structure, store and transport information Tags are not predefined Self-descriptive W3C Recommendation

Advantages Data stored in plain text format Easy for humans to read Hierarchical, and easily processed Provides a hardware and software independent way of storing data Different applications can easily share data through XML with low complexity Makes data more available Supports internationalization and platform changes

Structure XML docs form a tree structure Each document must have a unique first element, the root node Consists of tags and text Tags are case sensitive, come in pairs, must be nested properly A tag may have a set of attributes whose values must be quoted White space is preserved XML Docs that conform to above rules are said to be “Well formed”

Structure Continued… Elements with empty content can be abbreviated for XML has only one “basic” type – text XML text is called PCDATA (parsed character data) Tove Jani Reminder Don't forget me this weekend! Example from w3schools.com

Header tag Standalone=“no” means that there is an external DTD Encoding attribute can be left out and the processor will use the UTF-8 default From Dr. Praveen Madiraju’s slides

XML is self-descriptive Nesting of tags can be used to express various structure e.g. a tuple (record) Bart Simpson 02 – – From Dr. Praveen Madiraju’s slides

XML doc is a tree Bart Simpson 02 – – Leaves are either empty or contain PCDATA person name tel Bart Simpson 02 – – From Dr. Praveen Madiraju’s slides

Address Book as an XML document A list can be represented by using the same tag repetitively Donald Duck Miki Mouse From Dr. Praveen Madiraju’s slides

XML Elements vs. Attributes Anna Smith female Anna Smith There are no rules about when to use attributes or when to use elements. Elements are normally preferred over attributes, because:  attributes cannot contain multiple values (elements can)  attributes cannot contain tree structures (elements can)  attributes are not easily expandable (for future changes) From w3schools.com

A simple example : From Arofan Gregory’s slides

Top-Level Structure The entire document must get a single, top-level (“root”) element – in this case, we will name it “ ”: […] From Arofan Gregory’s slides

Mid-Level Structure Header Body The breaks down into two major structural parts: a header and a body These would be: … and … They would always be in the sequence Header, Body From Arofan Gregory’s slides

Lower-Level Structure The header contains another sequence of elements, each of which contain text: …, …, …, …, … From To CC Subject There could also be a BCC field From Arofan Gregory’s slides

Header Body Text FromToCC (?)BCC (?)Subject Text The XML instance can be understood as a structure: a hierarchy of elements and content. (This is often referred to as a “DOM” and is a common programming structure.) This structure can be described in a DTD or XML Schema. (?) means that element is optional. From Arofan Gregory’s slides

Resulting XML Instance News from Dagstuhl Dagstuhl is amazing, but they seem to be overrun by owls. I hope you guys are doing well, and that Calum isn’t watching too much TV. From Arofan Gregory’s slides

Namespaces Provide a method to avoid element name conflicts Name conflict often occurs when trying to mix XML docs from different XML applications XML carrying HTML table information Apples Bananas XML carrying information about a table (a piece of furniture) African Coffee Table From w3schools.com

Namespaces Cont’d… Name conflicts can easily be avoided using a name prefix A “namespace” for the prefix must be defined Namespace declaration has the syntax- xmlns:prefix="URI“ All child elements with the same prefix are associated with the same namespace Namespace URI is not used by the parser to look up information Companies often use the namespace as a pointer to a web page containing namespace information

Namespaces Cont’d… Apples Bananas African Coffee Table From w3schools.com

Document Type Definitions (DTD) An XML document may have an optional DTD DTD serves as grammar for the underlying XML document, and it is part of XML language DTD has the form: XML document conforming to its DTD is said to be valid From slides by Ayzer Mungan et. al.

DTD Example Alan 42 ……… ………. DTD for it might be: <!DOCTYPE db [ ]> From slides by Ayzer Mungan et. al.

XML Parser Software library (or a package) that provides methods (or interfaces) for client applications to work with XML documents Shields client from the complexities of XML manipulation May also validate the document From slides by Chongbing Liu

XML Parsing Standards We will consider two parsing methods that implement W3C standards for accessing XML SAX (Simple API for XML) Event-driven parsing “Serial access” protocol Read only API DOM (Document Object Model) Converts XML into a tree of objects “Random access” protocol Can update XML document (insert/delete nodes) From slides by Rajshekhar Sunderraman

SAX Parser Scans an xml stream on the fly Very different than digesting an entire XML document into memory. When the parser encounters start-tag, end-tag, etc., it thinks of them as events When such an event occurs, the handler automatically calls back to a particular method overridden by the client, and feeds as arguments the method what it sees Purely event-based, it works like an event handler in Java (e.g. MouseAdapter)

Obtaining SAX Parser //Important classes javax.xml.parsers.SAXParserFactory; javax.xml.parsers.SAXParser; javax.xml.parsers.ParserConfigurationException; //get the parser SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser saxParser = factory.newSAXParser(); //parse the document saxParser.parse( new File(argv[0]), handler);

SAX Event Handler Must implement the interface org.xml.sax.ContentHandler Easier to extend the adapter org.xml.sax.helpers.DefaultHandler Most important methods to override void startDocument() void endDocument() void startElement(...) void endElement(...) void characters(...)

SAX Parser Cont’d… Advantages  Simple and Fast  Memory efficient  Works well in stream application Disadvantages  Data is broken into pieces  Clients never have all the information as a whole unless they create their own data structure  Need to reparse if you need to revisit data From slides by Chongbing Liu

DOM Parser Creates a tree object out of the document User accesses data by traversing the tree The API allows for constructing, accessing and manipulating the structure and content of XML documents From slides by Rajshekhar Sunderraman DOM Parser DOM Tree XML File APIAPI Application

DOM Parser Create a DOM tree directly in memory DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); document = builder.newDocument(); Element root = doc.getDocumentElement(); Once the root node is obtained, typical tree methods exist to manipulate other elements boolean node.hasChildNodes() NodeList node.getChildNodes() Node node.getNextSibling() Node node.getParentNode() String node.getValue(); String node.getName(); String node.getText(); void setNodeValue(String nodeValue); Node insertBefore(Node new, Node ref);

DOM Parser Cont’d… Advantages  Random access possible  Easy to use  Can manipulate the XML document Disadvantages  DOM object requires more memory storage than the XML file itself  A lot of time is spent on construction before use  May be impractical for very large documents From slides by Rajshekhar Sunderraman

DOM and SAX Parsers From slides by Chongbing Liu

Thank You