Semistructured Data and XML - PowerPoint PPT Presentation

1 / 38
About This Presentation
Title:

Semistructured Data and XML

Description:

With style sheet. Without style sheet. Displaying errors. Marina G. Erechtchoukova. 21 ... Data Binding with Internet Explorer ... – PowerPoint PPT presentation

Number of Views:33
Avg rating:3.0/5.0
Slides: 39
Provided by: Mari630
Category:

less

Transcript and Presenter's Notes

Title: Semistructured Data and XML


1
Semistructured Data and XML
  • IntroductionChapter 30.1-30.2.2, but 30.1.2

2
Semistructured Data
  • Data that does not conform to a fixed schema
  • Has some structure, but the structure is not
    rigid
  • Reasons for that
  • Structure of data is unknown
  • Data come from different sources with different
    structures

3
Semistructured Data Management
  • DBMS
  • Schema is known a priori
  • Query language is declarative
  • Semistructured data
  • Tree-labeled representation
  • Query language is navigational

4
Object Exchange Model
  • Nested object model
  • OEM object can be
  • Atomic contains a value of a base type
  • Complex contains a complex value a collection
    of OEM objects (subobjects)
  • Complex object is a parent, a subobject is a
    child
  • OEM object can have several parent objects

5
OEM Objects
  • Each object is described by quadruple
  • Label string of characters describing what
    object represents
  • Identifying object
  • Identifying the meaning of the object
  • Type data type of the object value
  • Value variable length object value
  • Object-ID unique identifier used by the system
    and not presented to users

6
Diagrammatic representation of OEM
  • Directed graph
  • Nodes objects
  • Edges denote connections of objects and
    subobjects
  • Atomic object has no outgoing edge
  • Complex object has outgoing edges

7
OEM vs. OO Data Model
  • OEM is information exchange model
  • Does not specify how object is stored
  • Specifies how object is received
  • OEM supports
  • Object nesting
  • Object identity
  • OEM does not support classes, inheritance,
    methods and polymorphism

8
XML
  • Extensible means it can be used to create lots of
    document types
  • Markup means it specifies the structure and the
    content of a document
  • Language this is computer language

9
XML vs. HTML
  • Common features
  • Parent SGML
  • Text-based
  • Building blocks are tags, attributes and elements
  • HTML language for data presentation and
    formatting
  • No mechanism for monitoring documents content
  • XML emphasizes data content

10
Basic Terms
  • XML meta language
  • XML application
  • vocabulary
  • XML parser reads XML documents and provides
    access to their content and structure
  • Fatal error

11
Basic Terms (cont)
  • Well-formed document contains no syntax errors
    and satisfies W3C specifications
  • Valid document well-formed document that
    satisfied the rules of a particular XML
    application

12
Document Structure
  • Logical structure a set of elements or
    containers
  • An elements type (generic identifier)
    constraints element content
  • Name
  • Set of attributes
  • Attribute is specified as a pair name value

13
Main Document Components
  • The prolog
  • The root element
  • Other elements

14
Documents Prolog
  • XML declaration
  • Processing instructions
  • Document type declaration
  • Comments
  • White space

15
XML Declaration
  • First line of the document
  • lt?xml version1.0 encodingUTF-8
  • standaloneyes?gt
  • Version 1.0 corresponds to the W3C XML
    Recommendation 1.0
  • Encoding UTF-8 - default, Unicode, UCS-2,
    UCS-4,
  • Standalone references to external files

16
Processing Instructions
  • The instructions which are passed by XML parser
    to the application
  • Syntax
  • lt?piname pidata?gt
  • Can be used to connect XML documents with CSS
  • lt?xml-stylesheet typetext/css hrefURL?gt

17
Elements
  • An element start and end tags
  • ltpricegt 1987.47lt/pricegt
  • Empty element an element with no data
  • lthead/gt
  • Nesting elements
  • ltbookgt
  • lttitlegt Database Systems lt/titlegt
  • ltauthorgt Connolly, Begg lt/authorgt
  • lt/bookgt

18
Attributes
  • Attribute name conforms the following
  • Begins with a letter or _
  • Unique within the tag
  • Doesnt begin with xml
  • Space is not allowed
  • Attribute value is the information processed by
    the parser but is not viewed

19
Attribute Example
  • ltbook categoryITgt
  • lttitlegt Database Systems lt/titlegt
  • ltauthorgt Connolly, Begg lt/authorgt
  • lt/bookgt

20
Displaying XML Documents
  • Web browsers have XML parsers
  • Only well-formed documents are displayed
  • With style sheet
  • Without style sheet
  • Displaying errors

21
Data Binding
  • Mapping and synchronization of data in XML
    documents to HTML document
  • Data source
  • Data consumer
  • Involves
  • Moving data to a local system
  • Manipulating the data

22
Data Binding with Internet Explorer
  • Data binding agent and table repetition agent are
    utilities implemented as DLL in Internet Explorer
  • Data Source Objects
  • Tabular data control
  • Remote data service
  • JDBC DataSource applet
  • XML data source object

23
XML Data Source Object
  • Gathers data from different XML documents
  • Has unique methods to manipulate the data
  • Supports only well-formed and valid XML documents
  • Uses ADO to access the data
  • We can apply methods supported by ADO to data
    source object

24
Data Source Structure
  • A Field a single item of information
  • A record a collection of fields
  • Pseudo field Text contains character data from
    all the fields in a record
  • A recordset collection of records
  • Simple recordset
  • Hierarchical recordset

25
Recordsets
  • Simple recordset
  • Single root element
  • Each record has the same number of fields
  • Each field contains character data only
  • Hierarchical recordset
  • A collection of records nested inside of each
    other

26
Data Consumer Elements
  • Elements used to display XML data
  • lta hrefgt
  • ltdivgt
  • ltspangt
  • ltbuttongt
  • ltinput typegt
  • lttablegt
  • And some other

27
Data Islands
  • Source of data which is displayed
  • XML code describing the data
  • Internal data island
  • Is placed within the BODY of HTML document
  • External data island XML document

28
Internal Data Island
  • ltbodygt
  • ltxml idisland_namegt
  • lt?xml version1.0 ?gt
  • XML code
  • lt/xmlgt
  • lt/bodygt

29
External Islands
  • ltbodygt
  • ltxml id island_name
  • srcURL_of XML_ filegt lt/xmlgt
  • .
  • lt/bodygt

30
Binding a Single-Valued Data Consumer to XML Data
  • Create a data island with the name ILN
  • Within the body part of HTML document place a tag
    with attributes
  • ltdiv datasrcILN datafldfieldgtlt/divgt
  • where field is XML element or attribute

31
Working with Simple Recordset
  • Is based on ADO recordset
  • Recordset corresponds to a specified data island
  • Calling recordset methods
  • id.recordset.method()
  • Calling recorset properties
  • id.recordset.property

32
Recordset Methods
  • Move to the first record in the recordset
  • id.recordset.moveFirst()
  • Move to the previous record
  • id.recordset.movePrevious()
  • Move to the next record
  • id.recordset.moveNext()
  • Move to the last record in the recordset
  • id.recordset.moveLast()

33
Recordset Properties
  • Returns True if the beginning of the recordset is
    reached
  • id.recordset.BOF
  • Returns True if the end of the recordset is
    reached
  • id.recordset.EOF
  • Returns the number of current pointer position in
    the recordset
  • id.recordset.index
  • Returns the number of records in the recordset
  • id.recordset.RecordCount

34
Add Navigation Buttons with Simple Javascript
  • ltbutton onClickid.recordset.moveFirst()"gt
    Firstlt/buttongt
  • ltbutton onClickid.recordset.moveNext() if
    (id.recordset.EOF) id.recordset.moveLast()gtNext
    lt/buttongt

35
Binding Data to Tables
  • Simple recordset
  • lttable datasrcidgt
  • lttrgt
  • lttdgtltspan datafldfield1gtlt/spangtlt/tdgt
  • lttdgt
  • ltspan datafldfield2gtlt/spangtlt/tdgt
  • lt/trgt
  • lt/tablegt

36
Hierarchical Recordset (example)
37
Hierarchical Recorsets
  • Two-level recordset
  • lttable datasrcid datafldelementgt
  • lttrgt
  • lttdgtltspan datafldfield1gtlt/spangtlt/tdgt
  • lttdgtltspan datafldfield2gtlt/spangtlt/tdgt
  • lt/trgt
  • lt/tablegt

38
Hierarchical Recorsets
  • Example
  • lttable datasrcid datafldCardgt
  • lttrgt
  • lttdgtltspan datafldNamegtlt/spangtlt/tdgt
  • lttdgtltspan datafldKindgt lt/spangtlt/tdgt
  • lt/trgt
  • lt/tablegt
Write a Comment
User Comments (0)
About PowerShow.com