Cisc 3140 cis 20 2 design implementation of software application ii
This presentation is the property of its rightful owner.
Sponsored Links
1 / 23

CISC 3140 (CIS 20.2) Design & Implementation of Software Application II PowerPoint PPT Presentation


  • 56 Views
  • Uploaded on
  • Presentation posted in: General

CISC 3140 (CIS 20.2) Design & Implementation of Software Application II. Thanks to MatthewMeyer Email Address: [email protected] Course Page: http://www.sci.brooklyn.cuny.edu/~meyer/. Content. Interoperability XML What XML is used for Tree Structure Syntax Rules

Download Presentation

CISC 3140 (CIS 20.2) Design & Implementation of Software Application II

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Cisc 3140 cis 20 2 design implementation of software application ii

CISC 3140 (CIS 20.2)Design & Implementation of Software Application II

Thanks to MatthewMeyer

Email Address: [email protected]

Course Page: http://www.sci.brooklyn.cuny.edu/~meyer/


Content

Content

  • Interoperability

  • XML

  • What XML is used for

  • Tree Structure

  • Syntax Rules

  • Elements

  • Naming Rules

  • Attributes

  • Document Type Definition (DTD)


The death of codd s dream

The Death of Codd's Dream

  • Different RDBMS are NOT compatible.

    • Codd's 12 (13) commandments (for RDBMS) where supposed to insure that all RDBMS would be able to for work with each other.

    • Today, no RDBMS implements all 13 rules.

    • Proprietary systems implement their own rules.

    • Proprietary systems implement their own SQL.

  • And yet we need to share database information.

  • Interoperability: A property referring to the ability of diverse systems to work together.


Markup languages

Markup Languages

  • Markup languages allow us to add information to text, in a manner that is distinguishable from the text.

  • Within a markup language we find 3 distinct types of markup.

    • Presentational markup: WYSIWYG effect.

    • Procedural markup: Including instruction.

    • Semantic markup: Used to attach meaning to sections of text.


Cisc 3140 cis 20 2 design implementation of software application ii

XML

  • XML is a markup language (like HTML, SGML, ODF).

  • XML stands for eXtensible Markup Language and was initially released in the late 90's.

  • The XML standard was created by W3C to provide an easy to use and standardized way to store self-describing data (self-describing data is data that describes both its content and its structure)

  • XML is a very useful tool for allowing communication between otherwise incompatible database systems (in other words it provide interoperability).

  • In XML you can define your own tags.


Key terminology

Key Terminology

  • Tag: A markup construct that begins with "<" and ends with ">". Tags come in three flavors: start-tags, for example <x>, end-tags, for example </x>, and empty-element tags, for example <x/>.

  • Element: A component that begins with a start-tag and ends with a matching end-tag, or consists only of an empty-element tag. The characters between the start-and end-tags, if any, are the element's content, and may contain include other elements, which are called child elements. An example of an element is <x>Hello, world.</x>. Another is <x/>

  • Attribute: A construct consisting of a name/value pair that exists within a start-tag or empty-element tag. In the example (below) the element x has two attributes, id and instock:

  • <x id="3433" instock='no'/>.


Difference between xml and x html

Difference Between XML and (X)HTML

  • XML and HTML were designed with different goals:

  • XML was designed to transport and store data

    • Data-centric markup -> focus on data

    • XML allows the author to create his/her own tags

  • (X)HTML was designed to display documents

    • Document-centric markup -> focus on document

    • Default tag set allows designer to focus on how text is presented (how it looks)


Xml example

XML Example

  • XML was created to structure, store, and transport information

    <?xml version="1.0" encoding="ISO-8859-1"?>

    <bookstore>

    <book category="non-fiction">

    <title lang="en">Everyday Italian</title>

    <author>Giada De Laurentiis</author>

    <year>2005</year>

    <price>30.00<price>

    </book>

    </bookstore>

  • The first line is the XML declaration; It defines the XML version (1.0) and an encoding to use (Latin-1/West European character set)

  • The next line describes the root element of the document


Xml tree structure

XML Tree Structure

  • XML documents form a logical tree-like structure that starts at "the root" and branches into "the leaves".

  • XML documents must contain a root element.

  • This root elements is "the parent" of all other elements.

  • All elements can have sub elements (child elements)

  • Elements with the same parent are siblings.

<! – general form -->

<root>

  <child>    <subchild_A>

</subchild_A>

    <subchild_B>

</subchild_B>

  </child>

</root>

<! --A and B are siblings -->


Xml tree structure example

XML Tree Structure - Example


Rules for xml

Rules for XML

(all examples are WRONG)

  • XML elements must be properly nested

    • EX: <b><i>This text is bold and italic</b></i>

  • XML elements must always be closed

    • EX: <p>This is a paragraph

  • XML elements are case sensitive

    • EX: <x> Content of x </X>

  • XML documents must have one root element


Rules for xml cont

Rules for XML (cont)

(all examples are CORRECT)

  • Attribute values must be quoted

    • Ex: <table width="100%" id='33'>

  • XML elements must be properly named:

    • CAN contain letters, numbers, and other characters

    • CANNOT start with a number or punctuation

    • CANNOT start with the letters xml (XML, or Xml, etc)

    • CANNOT cannot contain spaces

    • CAN be any name you want (namespaces can be used to delimitate between identical names)

      • <f:name>

      • <g:name>


Xml attributes

XML Attributes

  • Attributes often provide information that is not a part of the data (meta-data).

  • There are problems with using attributes:

    • Attributes cannot contain multiple values (elements can)

    • Attributes cannot contain tree structures (elements can)

    • Attributes are not easily expandable (for future changes)

    • Attributes are more difficult to read and maintain. Use elements for data.

  • In general use attributes for information that is not part of the data itself (meta-data).


What do we use xml for

What do we use XML for?

  • XML Simplifies Data Sharing

    • XML data is stored in plain text in a standardized format. This provides a software- and hardware-independent way of storing data.

  • XML Simplifies Data Transport

    • Exchanging data as XML greatly reduces the complexity of exchanging data amongst different systems (SOAP, ODF).


What do we use xml for cont

What do we use XML for (cont)?

  • XML Simplifies Platform Changes

    • Makes it easier to expand or upgrade to new operating systems, new applications, or new browsers, without losing data.

  • XML Separates Data from HTML

    • Store data in separate XML files. This way you can concentrate on using HTML for layout and display, and be sure that changes in the underlying data will not require any changes to the HTML.


Problems with xml

Problems with XML

  • XML is profoundly wasteful in terms of storage space requirements:

    • Repeated tag names induce repeated “overhead” cost (2N +5)E where N denotes the average size of tag names in the document and E is the number of elements..

  • Working with XML is also costly, whether I move it in and out of a RDMS to query it, or I query it natively (XPATH, XSLT, Xquery).


Document type definitions dtds

Document Type Definitions (DTDs)

  • The purpose of a DTD (Document Type Definition) is to define the legal building blocks of a particular XML document.

  • If the DTD is declared inside the XML file, it should be wrapped in a DOCTYPE definition with the following syntax:

    <!DOCTYPE root-element [element-declarations]>


Dtd in file declaration

DTD In-File Declaration

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE note [<!ELEMENT note (to,from,heading,body)><!ELEMENT to (#PCDATA)><!ELEMENT from (#PCDATA)><!ELEMENT heading (#PCDATA)><!ELEMENT body (#PCDATA)>

]>

<note date=“12/23/2010”><to>Jack</to><from>Jill</from><heading>Reminder</heading><body>Pick up some water!</body>

</note>


Dtd external file declaration

DTD External-File Declaration

  • If the DTD is declared in an external file, it should be wrapped in a DOCTYPE definition with the following syntax:

    <?xml version="1.0"?>

    <!DOCTYPE note SYSTEM "note.dtd">

    <note date=“12/23/2010”><to>Jack</to><from>Jill</from><heading>Reminder</heading><body>Pick up some water!</body></note>


Well formed vs valid xml

Well-Formed VS. Valid XML

  • An XML document that is “well-formed” is obeying all of the rules for XML.

  • A "Valid" XML document is a "Well Formed" XML document, which also conforms to the rules of a DTD or XSD.

  • W3C Schools has a “validator” tool that you can use to see if an XML document is valid for a particular DTD.


Sample applications

CISC3140-Meyer-lec7

Sample Applications

  • The Text Encoding Initiaive (TEI): example

  • x3d: example

  • FlightGear flight simulator: example

  • A gazillion others


You got this

You got this…

  • This lecture has been mostly about defining XML in terms of a data storage and transport mechanism.

  • In your lab you will create some XML files with a DTD. See if you can get them to validate.

  • Next week we will look at XML in terms of its use in data retrieval systems (rather than relational tables).

  • XHTML is a valid subset of XML, and is used to create web-pages. Why would this be advantageous?


Cisc 3140 cis 20 2 design implementation of software application ii

Source

  • http://www.w3schools.com/xml/default.asp


  • Login