An Introductory Tutorial. Background and Purpose.

Slides:



Advertisements
Similar presentations
XML III. Learning Objectives Formatting XML Documents: Overview Using Cascading Style Sheets to format XML documents Using XSL to format XML documents.
Advertisements

Copyright © Steven W. Johnson
The eXtensible Markup Language (XML) An Applied Tutorial Kevin Thomas.
Alternative FILE formats
XML: text format Dr Andy Evans. Text-based data formats As data space has become cheaper, people have moved away from binary data formats. Text easier.
XML/EDI Overview West Chester Electronic Commerce Resource Center (ECRC)
Teppo Räisänen LIIKE/OAMK 2010
SPECIAL TOPIC XML. Introducing XML XML (eXtensible Markup Language) ◦A language used to create structured documents XML vs HTML ◦XML is designed to transport.
JSON IDU0075 Sissejuhatus veebiteenustesse.  JSON stands for JavaScript Object Notation  JSON is lightweight text-data interchange format  JSON is.
XML by Jon Pearce. What is XML? XML = eXstensible Markup Language = a meta language for defining markup languages. Examples: MathML, SVG (Scalable Vector.
XML Introduction What is XML –XML is the eXtensible Markup Language –Became a W3C Recommendation in 1998 –Tag-based syntax, like HTML –You get to make.
XML(EXtensible Markup Language). XML XML stands for EXtensible Markup Language. XML is a markup language much like HTML. XML was designed to describe.
15-Jul-15 JSON. JSON example “JSON” stands for “JavaScript Object Notation” Despite the name, JSON is a (mostly) language-independent way of specifying.
HTML-XML Conversion Information presentation is a vital factor to every business, hence our data conversion services can be helpful to any type of business.
JXON An Architecture for Schema and Annotation Driven JSON/XML Bidirectional Transformations David A. Lee Senior Principal Software Engineer Slide 1.
INTRODUCTION TO HTML5 CSS Styles. Understanding Style Sheets  HTML5 enables you to define many different types of content on a web page, including headings,
Copyright © Curt Hill The Internet An Introduction.
Copyright © 2012 Accenture All Rights Reserved.Copyright © 2012 Accenture All Rights Reserved. Accenture, its logo, and High Performance Delivered are.
XML The Overview. Three Key Questions What is XML? What Problems does it solve? Where and how is it used?
An Introduction to XML Presented by Scott Nemec at the UniForum Chicago meeting on 7/25/2006.
CISC 3140 (CIS 20.2) Design & Implementation of Software Application II Instructor : M. Meyer Address: Course Page:
The New Zealand Institute for Plant & Food Research Limited Matthew Laurenson Web Services: Introduction & Design Considerations.
CIT 383: Administrative Scripting
Lecture 13 – XML and JSON SFDV3011 – Advanced Web Development Reference: 1.
 2008 Pearson Education, Inc. All rights reserved Introduction to XHTML.
PCWG Analysis Tool Peter Stuart September 15, 2015.
XML eXtensible Markup Language. Topics  What is XML  An XML example  Why is XML important  XML introduction  XML applications  XML support CSEB.
XML and Digital Libraries M. Zubair Department of Computer Science Old Dominion University.
1 Introduction  Extensible Markup Language (XML) –Uses tags to describe the structure of a document –Simplifies the process of sharing information –Extensible.
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.
JSON Java Script Object Notation Copyright © 2013 Curt Hill.
XML Alyssa Roberts. What is XML? Extensible Markup Language Specification to creating custom mark-up languages Simplified version of SGML, originally.
Structured Documents - XML and FrameMaker 7 Asit Pant.
Representing data with XML SE-2030 Dr. Mark L. Hornick 1.
XML and JSON 1. XML, a very brief introduction XML = eXtensible Markup Language Language to describe data to be exchanged on the web And many other things.
1 D O C U M E N T A T I O N & I N F O R M A T I O N S E R V I C E S 1 Improved Dissemination of NMMSS Products and Reports NMMSS Software Engineer 5/20/2009.
AJAX. Ajax  $.get  $.post  $.getJSON  $.ajax  json and xml  Looping over data results, success and error callbacks.
XML The Overview. Three Key Questions What is XML? What Problems does it solve? Where and how is it used?
OVERVIEW AND PARSING JSON. What is JSON JavaScript Object Notation Used to format data Commonly used in Web as a vehicle to describe data being sent between.
Web Design New Brighton High School Exploring the History of the World Wide WebWorld Wide Web.
VCE IT Theory Slideshows by Mark Kelly study design By Mark Kelly, vceit.com, Begin.
Google maps engine and language presentation Ibrahim Motala.
XML Extensible Markup Language
PART 1 XML Basics. Slide 2 Why XML Here? You need to understand the basics of XML to do much with Android All of they layout and configuration files are.
JSON (Copied from and from Prof Da Silva) Week 12 Web site:
XML & JSON. Background XML and JSON are to standard, textual data formats for representing arbitrary data – XML stands for “eXtensible Markup Language”
Assistive Technology for Information Access (Visual Impairments) UNDERSTANDING ACCESSIBLE FORMATS.
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.
The Fat-Free Alternative to XML
The Object-Oriented Thought Process Chapter 11
The Fat-Free Alternative to XML
JSON.
Server-Side Application and Data Management IT IS 3105 (FALL 2009)
JSON Crash Course Traversy Media.
CO4301 – Advanced Games Development Week 2 Introduction to Parsing
CFS Community Day Core Flight System Command and Data Dictionary Utility December 4, 2017 NASA JSC/Kevin McCluney December 4, 2017.
Optimized Rewriter Rules for Efficient Querying of JSON Data
Tutorial 8 Objectives Continue presenting methods to import data into Access, export data from Access, link applications with data stored in Access, and.
Soo Park and Janine Aquino
Introduction to Python
Built in Fairfield County: Front End Developers Meetup
Upcoming changes to the DMX technical standard
Tree Visualization.
JSON Data Demo.
Strings and Serialization
Smart Integration Express
Department of Computer Science Cal State East Bay, Hayward, CA
CS 240 – Advanced Programming Concepts
Review of XML IST 421 Spring 2004 Lecture 5.
Extensible Markup Language (XML)
Presentation transcript:

An Introductory Tutorial

Background and Purpose

What is YAML?  Human friendly, cross language, Unicode based data serialization language.  Pronounced in such a way as to rhyme with “camel”  Acronym for YAML Ain’t Markup Language

What is a data serialization language?  A language used to convert or represent structured data or objects as a series of characters that can be stored on a disk.  Examples: CSV – Comma separated values XML – Extensible markup language JSON – JavaScript object notation YAML – YAML ain’t markup language

Why YAML if XML?  Unlike XML which is not easily readable by humans, YAML was created to be human- friendly and integrate easily with modern programming languages.  Unlike with XML, YAML was intended to simplify the viewing and understanding of config files, log files, object persistence, and messaging, to allow the programmer to spend more time programming and less time formatting data.

YAML Design Goals  As stated in the YAML official specification, the design goals for YAML in decreasing priority are: 1. YAML is easily readable by humans 2. YAML data is portable between programming languages 3. YAML matches the native data structures of agile languages. 4. YAML has a consistent model to support generic tools. 5. YAML supports one-pass processing. 6. YAML is expressive and extensible. 7. YAML is easy to implement and use.

Syntax and Language Elements

Basic YAML Syntax Rules  Documents begin with --- and end with …  Indentation of lines denotes the structure within the document.  Comments begin with #  Members of lists begin with –  Key value pairs use the following syntax :

Basic YAML Syntax Rules  Example: --- Student-Id: First-Name: John Last-Name: Smith Phone-numbers: Addresses: - street: 123 Main St. city: Houston state: TX...

Advanced YAML Syntax  There is more advanced syntaxes that exist that allow YAML to represent Relational trees ○ *, <<, and & are used for node reference, array merges, and anchoring respectively User defined data types  These are beyond the scope of this introductory tutorial.

Integration and Usage

How to Integrate YAML and Ruby?  Thankfully, YAML support comes built in to Ruby with the use of the yaml library.  Simply add the below Ruby code to the top of any Ruby file to get YAML support. require ‘yaml’

How to Integrate YAML and Ruby  After the yaml library has been included in a file, you then have access to the to_yaml method that can be used on any Ruby Object.  to_yaml returns a String in YAML syntax that represents the Object being converted.  Remember, everything in Ruby is an Object, therefore everything can easily be converted to YAML notation and written to disk.

How to Integrate YAML and Ruby  Example: require 'yaml' class Graph attr_reader :graph_name # Serializes a graph to YAML format and saves it to # a file with the same name as the graph # and returns the path to the file. def serialize # build the filename for the serialized data file_name = # create and write the YAML data to the file File.open(file_name, 'w+') do |f| f.write(self.to_yaml) end # return the file path File.path(file_name) end

How to Integrate YAML and Ruby  Example: # Restores a previously saved graph from its corresponding YAML file # with the passed in name. def loadGraph(name) # the DSL expects the name argument to be a String. validate_stringness_of name, :method => :loadGraph # load the YAML file from the disk print "Loading #{name}.yml" yml_graph = YAML.load_file "#{name}.yml" # ensure the data loaded is actually a Graph and set it to the Graph instance variable. # otherwise let the user know that there was no Graph data in the YAML file. if yml_graph.kind_of? = yml_graph puts " ---> Graph has been loaded!" else puts " ---> Error: #{name}.yml failed to load due to unknown object: puts #{yml_graph.class}." exit end

Extended Example  Please refer to the below files to see the full example. graphn.rb graph.rb create_graph.gn load_graph.gn