chp2 Data Serialization Essay example

Submitted By vijugidde
Words: 1535
Pages: 7

Chapter 2
Data Structure and Serialization Format


Review Basic SQL Statements (create, insert, select, update)
Data Serialization Formats
Introduction to XML and XSD
JSON and JSON Schema
Apache AVRO
Basic Linux Commands

Data Serialization
• Serialization – Introduction

“The process of converting an object (or a graph of objects) into a linear sequence of bytes for either storage or transmission to another location.”


What is serialization?

What is deserialization?


“The process of taking in stored information a nd recreating objects from it.”
• Wikipedia currently has a decent overview of serialization

how to deserialize badly

• What does the program need to know to rebuild an identical objec t in memory?
• Text or binary format
• If binary, need to know everything

• If text, what byte encoding?
• If valid XML, we can at least read in the data
• But whether we know what to do with it is uncertain


• If a program is both the serializer and deserializer, things are str aightforward. • If a program receives a serialized file from another company:

Protocol Buffers


some serialization formats


HTML was designed to display data.
XML stands for eXtensible Markup Language.
XML was designed to carry data, not to display data
XML tags are defined by you, not pre-defined
XML tag is self-descriptive

• XML document does not DO anything.
• It is just information wrapped in tags.
< to>Tove</to>
< from>Jani</from>
< heading>Reminder</heading>
< body>Don't forget me this weekend!</body>
< /note>

• With XML You create Your Own Tags
• XML is Not a Replacement for HTML
• XML is now as important for the Web as HTML was to the foundation of the Web.
• XML is the most common tool for data transmissions between applica tions. XML Separates Data from HT
• To display dynamic data in your HTML document, it will take a l ot of work to edit the HTML each time the data changes.
• With XML, data can be stored in separate XML files. This way y ou can concentrate on using HTML/CSS for display and layout, and be sure that changes in the underlying data will not requir e any changes to the HTML.
• With JavaScript, you can read an external XML file and update the data content of your web page.

An Example XML Document
<?xml version="1.0" encoding="UTF-8"?>
< note>
< to>Tove</to>
< from>Jani</from>
< heading>Reminder</heading>
< body>Don't forget me this weekend!</body>
< /note>

• The first line is the XML declaration. It defines the XML version (1.0).
• Next line is root element
• Line 3-6 are child elements

XML Documents -- a Tree Structure
• XML documents must contain a root element
• All elements can have sub elements (child elements):

< /root>

< book category="COOKING">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
< /book>
< book category="CHILDREN">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
< /book>
< book category="WEB">
<title lang="en">Learning XML</title>
<author>Erik T. Ray</author>
< /book>
< /bookstore>

XML Book store Exa mple XML Syntax Rules

XML documents must have a root element
XML elements must have a closing tag
XML tags are case sensitive
XML elements must be properly nested
XML attribute values must be quoted

XML Schema
• An XML Schema describes the structure of an XML doc.
• An XML doc with correct syntax is called "Well Formed".
• An XML document validated against an XML Schema is both “Well Forme d” and “Valid“.
<xs:element name="note">
< xs:complexType>
<xs:element name="to" type="xs:string"/>