Your SlideShare is downloading. ×
XML Databases
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

XML Databases

1,890
views

Published on

Published in: Technology

0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,890
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
157
Comments
0
Likes
4
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. XML and Databases Jussi Pohjolainen TAMK University of Applied Sciences
  • 2. Similarities between XML and DB Database XML Storage XML-document DB model (relational) DTD and/or Schema Query Language (SQL) XQuery, XPath DB API (JDBC) DOM and SAX
  • 3. Database Benefits
    • XML "environment" lacks techniques that are built in into DBs:
      • Indexing
      • Efficient storage
      • Support for multiple users
      • Transactions
      • Security
      • Locking
  • 4. Storing XML into DB
    • XML-documents can be stored into DB
    • When storing xml into DB one must clarify the type of xml..
    • XML-document types:
      • Data centric
      • Document centric
  • 5. Data Centric vs. Document Centric?
    • Data centric
      • Usually generated by some system.
      • Server similar function to a database
      • Usually it does not matter in which order sibling-elements are.
      • Examples: books.xml
    • Document centric
      • Document focus
      • Does not have predictable structure
      • Usually the order of elements are crucial
      • Examples: xhtml
  • 6. DB Types
    • Database can be
      • XML-enabled DB
        • Information in DB is NOT in XML
        • Requires a layer that converts XML to DB model
        • Problem: can lost information about the xml-document (order)
        • Use with Data Centric documents!
      • Native XML
        • XML is the fundamental unit of storage
        • Does not lose any information
        • Can be used with Data centric and Document centric documents!
  • 7. Loss of Information?
    • When using XML-enabled DBs, xml document is transformed from xml to db model.
    • When transforming, it is possible that some information will be lost.
      • Order of sibling elements
      • Order of attributes
    • But this does not matter, if the xml is data centric!
  • 8. Designing XML – document for DB
    • The use of elements?
      • <customer>
      • <firstname>Homer</firstname>
      • <lastname>Simpson</lastname>
      • </customer>
    • The use of attributes?
      • <customer firstname=&quot;Homer&quot; lastname=&quot;Simpson&quot;/ >
  • 9. Attribute vs. Element
    • Readability
      • matter of opinion
    • Types
      • Schema: just the same
      • DTD: with dtd you can define more detailed datatypes for attributes
    • Programming
      • DOM and SAX programming is easier if the xml uses attributes
    • Document size
      • When using attributes, the size of the xml – document is smaller
    • Compatibility with DB
      • When using attributes, xml document is closer to relational databases..
  • 10. MySQL and XML
    • Exporting xml – data
      • mysqldump --xml databasename [tables]
      • http://dev.mysql.com/doc/refman/6.0/en/mysqldump.html
    • Importing xml – data
      • LOAD XML (Only with MYSQL 6)
      • http://dev.mysql.com/doc/refman/6.0/en/load-xml.html
  • 11. WEB SERVICE
  • 12. Problem in the Internet Client B2C Website Partner Partner Partner xhtml e-mail phone e-mail
  • 13. Solution Client B2C Website Partner Partner Partner xhtml xml xml xml
  • 14. Web Service
    • Web Service: a software system designed to support interoperable machine-to-machine interaction over a network
    • Communication system for different machines, platforms and programming languages
    • Service requester -> Service provider
  • 15. XML?
    • Web Service technology uses following XML – languages
      • SOAP (Simple Object Access Protocol)
        • SOAP is xml – language used when communicating with provider and requester
      • WSDL (Web Service Description Language)
        • WSDL is xml – language which is used to describe the service
  • 16. SOAP Example: Request
    • <?xml version=&quot;1.0&quot;?>
    • <soap:Envelope
    • xmlns:soap=&quot;http://www.w3.org/2001/12/soap-envelope&quot;
    • soap:encodingStyle=&quot;http://www.w3.org/2001/12/soap-encoding&quot;>
    • <soap:Body xmlns:m=&quot;http://www.example.org/stock&quot;>
    • <m:GetStockPrice>
    • <m:StockName>IBM</m:StockName>
    • </m:GetStockPrice>
    • </soap:Body>
    • </soap:Envelope>
  • 17. SOAP Example: Response
    • <?xml version=&quot;1.0&quot;?>
    • <soap:Envelope
    • xmlns:soap=&quot;http://www.w3.org/2001/12/soap-envelope&quot;
    • soap:encodingStyle=&quot;http://www.w3.org/2001/12/soap-encoding&quot;>
    • <soap:Body xmlns:m=&quot;http://www.example.org/stock&quot;>
    • <m:GetStockPriceResponse>
    • <m:Price>34.5</m:Price>
    • </m:GetStockPriceResponse>
    • </soap:Body>
    • </soap:Envelope>
  • 18. THANK YOU!