CSC Web Technologies, Spring Web Data Exchange Formats

Similar documents
So, if you receive data from a server, in JSON format, you can use it like any other JavaScript object.

Well-formed XML Documents

COMP9321 Web Application Engineering

Introduction to JSON. Roger Lacroix MQ Technical Conference v


This tutorial will help you understand JSON and its use within various programming languages such as PHP, PERL, Python, Ruby, Java, etc.

markup language carry data define your own tags self-descriptive W3C Recommendation

Intro to XML. Borrowed, with author s permission, from:

/ Introduction to XML

User Interaction: XML and JSON

Java EE 7: Back-end Server Application Development 4-2

CSC 337. JavaScript Object Notation (JSON) Rick Mercer

CSI 3140 WWW Structures, Techniques and Standards. Representing Web Data: XML

XML: Introduction. !important Declaration... 9:11 #FIXED... 7:5 #IMPLIED... 7:5 #REQUIRED... Directive... 9:11

Assigns a number to 110,000 letters/glyphs U+0041 is an A U+0062 is an a. U+00A9 is a copyright symbol U+0F03 is an

Overview. Introduction. Introduction XML XML. Lecture 16 Introduction to XML. Boriana Koleva Room: C54

Flat triples approach to RDF graphs in JSON

Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 7 XML

7.1 Introduction. extensible Markup Language Developed from SGML A meta-markup language Deficiencies of HTML and SGML

XML, XPath, and XSLT. Jim Fawcett Software Modeling Copyright

.. Cal Poly CPE/CSC 366: Database Modeling, Design and Implementation Alexander Dekhtyar..

XML 2 APPLICATION. Chapter SYS-ED/ COMPUTER EDUCATION TECHNIQUES, INC.

JSON Support for Junos OS

XML. XML Syntax. An example of XML:

Creating Markup with XML

Grading for Assignment #1

Chapter 13 XML: Extensible Markup Language

Creating Markup with XML

Chapter 1: Getting Started. You will learn:

extensible Markup Language

Introduction to XML. An Example XML Document. The following is a very simple XML document.

Chapter 10: Understanding the Standards

Packaging Data for the Web

Fundamentals of Web Programming a

XML. Jonathan Geisler. April 18, 2008

CGS 3066: Spring 2015 JavaScript Reference

2009 Martin v. Löwis. Data-centric XML. XML Syntax

Grid Computing. What is XML. Tags, elements, and attributes. Valid and well formed XML. Grid Computing Fall 2006 Paul A.

Processing XML and JSON in Python

JSON is a light-weight alternative to XML for data-interchange JSON = JavaScript Object Notation

XML 2 APPLICATION. Chapter SYS-ED/ COMPUTER EDUCATION TECHNIQUES, INC.

Extensible Markup Language (XML) Hamid Zarrabi-Zadeh Web Programming Fall 2013

Copyright 2007 Ramez Elmasri and Shamkant B. Navathe. Slide 27-1

Introduction to XML Zdeněk Žabokrtský, Rudolf Rosa

INTERNET PROGRAMMING XML

XML. Objectives. Duration. Audience. Pre-Requisites

COMP9321 Web Application Engineering. Extensible Markup Language (XML)

XML Processing & Web Services. Husni Husni.trunojoyo.ac.id

XDS An Extensible Structure for Trustworthy Document Content Verification Simon Wiseman CTO Deep- Secure 3 rd June 2013

extensible Markup Language (XML) Basic Concepts

BTE2313. Chapter 2: Introduction to C++ Programming

JSON as an XML Alternative. JSON is a light-weight alternative to XML for datainterchange

Comp 336/436 - Markup Languages. Fall Semester Week 4. Dr Nick Hayward

XML Information Set. Working Draft of May 17, 1999

XML. Part I XML Document and DTD

CountryData Technologies for Data Exchange. Introduction to XML

Kyle Rainville Littleton Coin Company

Web Services Part I. XML Web Services. Instructor: Dr. Wei Ding Fall 2009

XML stands for Extensible Markup Language and is a text-based markup language derived from Standard Generalized Markup Language (SGML).

[301] JSON. Tyler Caraza-Harter

Session 23 XML. XML Reading and Reference. Reading. Reference: Session 23 XML. Robert Kelly, 2018

Introduction to XML. Chapter 133

Outline. XML vs. HTML and Well Formed vs. Valid. XML Overview. CSC309 Tutorial --XML 4. Edward Xia

B4M36DS2, BE4M36DS2: Database Systems 2

7.1 Introduction. 7.1 Introduction (continued) - Problem with using SGML: - SGML is a meta-markup language

1 Overview. 1.1 Invocation. Text Assembler Users Guide. Description

XML: Extensible Markup Language

ECMA-404. The JSON Data Interchange Syntax. 2 nd Edition / December Reference number ECMA-123:2009

M359 Block5 - Lecture12 Eng/ Waleed Omar

Chapter 1. Creating XML Documents

Composer Help. Web Request Common Block

Computer Science E-75 Building Dynamic Websites

XML (Extensible Markup Language)

The concept of DTD. DTD(Document Type Definition) Why we need DTD

11. EXTENSIBLE MARKUP LANGUAGE (XML)

W3C XML XML Overview

XML & Related Languages

Contents. Topics. 01. WWW 02. WWW Documents 03. Web Service 04. Web Technologies. Management of Technology. C01-1. Documents

What is XML? XML is designed to transport and store data.

Lecture 8 (7.5?): Javascript

Internet Engineering Task Force (IETF) Obsoletes: 4627, 7158 March 2014 Category: Standards Track ISSN:

AJAX: The Basics CISC 282 November 22, 2017

Working with JavaScript

XML and DTD. Mario Alviano A.Y. 2017/2018. University of Calabria, Italy 1 / 28

XML JavaScript Object Notation JSON Cookies Miscellaneous What Javascript can t do. OOP Concepts of JS

Introduction to XML. National University of Computer and Emerging Sciences, Lahore. Shafiq Ur Rahman. Center for Research in Urdu Language Processing

Chapter 7: XML Namespaces

AJAX: The Basics CISC 282 March 25, 2014

Semistructured Data and XML

Author: Irena Holubová Lecturer: Martin Svoboda

Computer Science & Engineering 120 Learning to Code

Chapter 1 Introduction to Computers and the Internet

Overview of the JSON Encoding Rules (JER)

XML module 2. Creating XML. Hans C. Arents. senior IT market analyst. I.T. Works. Guiding the IT Professional

Decision Making in C

Schema Document Has Different Target Namespace From The One Specified In Instance Document

웹기술및응용. XML Basics 2018 년 2 학기. Instructor: Prof. Young-guk Ha Dept. of Computer Science & Engineering

LABORATORY 117. Intorduction to VoiceXML

TagSoup: A SAX parser in Java for nasty, ugly HTML. John Cowan

Markup Languages SGML, HTML, XML, XHTML. CS 431 February 13, 2006 Carl Lagoze Cornell University

Transcription:

CSC 342 - Web Technologies, Spring 2017 Web Data Exchange Formats

Web Data Exchange Data exchange is the process of transforming structured data from one format to another to facilitate data sharing between programs A data exchange language is a language that is capable of expressing general purpose data We will look at two data exchange languages that are commonly used to exchange data on the web: Extensible Markup Language (XML) JavaScript Object Notation (JSON)

Extensible Markup Language (XML) XML is a markup language that uses a textual data format to represent arbitrary data structures Schema systems exist for XML that enable XML based languages to be defined and validated The file extension for XML files is.xml The MIME type for XML text is application/xml

XML vs HTML XML was designed as a data exchange format HMTL was designed to display data to the user XML tags are not predefined XML was designed to be extensible

Basic XML Syntax Rules An XML document begins with an optional declaration, for example: <? xml version ="1.0" encoding =" UTF -8"? > XML documents must have a root element that is the parent of all other elements XML elements must have a closing tag XML tags are case sensitive XML elements must be properly nested XML attributes must be quoted

XML Elements An XML element is a logical document component with the following basic syntax: < element attribute =" value "> content </ element > Tags begin with < and end with > start-tag: <element> end-tag: </element> empty-element-tag: <element /> Attribute values must be in quoted (single or double quotes)

XML Element Naming Rules Element names are case sensitive Element names must start with a letter or an underscore Element names cannot start with the letters xml (in any combination of upper and lower case) Element names can contain letters, digits, hyphens, underscores, and periods Element names cannot contain spaces

XML Entities There are five pre-defined entity references < less than (<) > greater than (>) & ampersand (&) &apos; apostophe ( ) " quotation mark ( )

XML Comments Comments in XML begin with <!-- and end with --> <!-- This is a comment -- > Two dashes -- are not allowed in a comment Comments cannot be nested as a consequence of the previous rule

XML Namespaces XML elements are not predefined, so there is a chance that two different XML documents use the same element name XML Namespaces are a way to handle element name conflicts A namespace declaration has the following syntax xmlns:prefix ="URI " Example: <p:ul xmlns :p=" https :// example. com /p"> <p:li > Item 1 </p:li > <p:li > Item 2 </p:li > </p:list >

Accessing XML with JavaScript The XML DOM defines properties and methods for accessing and editing XML XML text data can be converted into an XML DOM object using the DOMParser object var parser = new DOMParser (); x = parser. parsefromstring (t, " text / xml "); // t is variable containing an XML string

Valid XML Documents A well formed XML document follows the XML syntax rules A valid XML document must be well formed and conform to a document type definition There are two main schema systems that can be used with XML Document Type Definition (DTD) XML Schema The purpose of a schema is to define the structure of an XML document including: The elements and attributes that can appear in a document The number and order of child elements The data types for elements and attributes The default and fixed values for elements and attributes

JavaScript Object Notation (JSON) JSON is designed to be a lightweight data exchange language JSON is data is plain text The file extension for JSON files is.json The MIME type for JSON text is application/json

JSON Syntax JSON syntax is similar to the syntax of defining literal objects in JavaScript: Data is in name/value pairs of the form "name":value Data is separated by commas Curly braces hold objects Square braces hold arrays

JSON Data Types Number: a signed decimal number String: a sequence of zero or more unicode characters delimited by by double quotes Boolean: a value of true or false Array: an ordered list of zero or more values separated by commas and delimited by square brackets Object: an unordered collection of name/value pairs where pairs are separated by commas and delimited by curly braces Null: the empty value indicated by the word null

Accessing JSON with JavaScript JSON.parse(): convert a JSON string into a JavaScript type JSON.stringify(): convert a JavaScript object into JSON text JavaScript Date objects are converted into strings JavaScript functions are removed since they are not valid

XML vs JSON Similarities self describing (human readable) hierarchical (nested values) can be parsed by many programming languages can be fetched with XMLHttpRequest Differences JSON does not use end tags XML is more difficult to parse than JSON JSON has an array type JSON cannot be validated by a schema (yet)