Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

XML and XSLT: Sharing Database Data with Suppliers using XML, Study notes of Database Management Systems (DBMS)

This lecture discusses how to share database data with suppliers using xml. The concept of xml as a standard way to describe document content, its customizability, and its comparison with html. The lecture also covers the document type declaration (dtd) and its role in defining the structure of an xml document, as well as xslt, a separate language used to transform xml documents into other formats like html. The document also touches upon xml schema as an alternative to dtd for defining the structure of xml documents.

Typology: Study notes

Pre 2010

Uploaded on 08/05/2009

koofers-user-8hr
koofers-user-8hr 🇺🇸

10 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSIS 350 – Lecture 27
Announcements
Exam Review next time. Come prepared to ask questions.
Discuss homework status.
Chapter 13
Let's say that you have a big organization, and you want to share DB data with your
suppliers to automate delivery of new products. So, transactions from your invoice DB
need to be sent to the various suppliers, and loaded as transactions in their DB.
How might you go about doing this? What should the extracted data look like?
XML
XML (extensible Markup Language)
- standard way to describe content of documents
- customizable
- can use it to describe a database view so that extracts are easily understood
Compare with HTML
- both markup languages
- HTML contains markup for content, structure, and materialization (how
document will appear)
- HTML has fixed set of tags, XML allows you to define new tags.
- HTML tags are confounded – what does <h2> tag mean?
oheading
obold, certain size font
Example XML document - See the file Figure13-1.xml
Note that this file has two parts:
- the top part is called the Document Type Declaration, or DTD
- the second part is the data
DTD:
- describes structure of document
- metadata!
DTD:
- begins with the word DOCTYPE – in this case the type is Customer
- Then it specifies the content of the document
pf3
pf4
pf5

Partial preview of the text

Download XML and XSLT: Sharing Database Data with Suppliers using XML and more Study notes Database Management Systems (DBMS) in PDF only on Docsity!

CSIS 350 – Lecture 27

Announcements Exam Review next time. Come prepared to ask questions. Discuss homework status. Chapter 13 Let's say that you have a big organization, and you want to share DB data with your suppliers to automate delivery of new products. So, transactions from your invoice DB need to be sent to the various suppliers, and loaded as transactions in their DB. How might you go about doing this? What should the extracted data look like? XML XML (extensible Markup Language)

  • standard way to describe content of documents
  • customizable
  • can use it to describe a database view so that extracts are easily understood Compare with HTML
  • both markup languages
  • HTML contains markup for content, structure, and materialization (how document will appear)
  • HTML has fixed set of tags, XML allows you to define new tags.
  • HTML tags are confounded – what does

    tag mean? o heading o bold, certain size font Example XML document - See the file Figure13-1.xml Note that this file has two parts:

  • the top part is called the Document Type Declaration, or DTD
  • the second part is the data DTD:
  • describes structure of document
  • metadata! DTD:
  • begins with the word DOCTYPE – in this case the type is Customer
  • Then it specifies the content of the document

In this example, the data conforms to the DTD – it is said to be type-valid. If the data did not conform to the DTD it would be type-invalid. It could still be an XML document: for example, if there were two s. More typically, the DTD is stored separately from the data. In this case, the !DOCTYPE definition includes a reference to the file that contains the DTD, like this:

See Example.xml and customerlist.dtd. The advantage of this is that lots of documents can use the same DTD. What happens if we try to look at the above document in a browser? Well, depending on the browser, different things will happen, but usually you'll see the structure of the document. **XSLT** HTML tags also describe how a document should be _materialized_ or formatted. XML document does not include this. With XML, there is a separate part that does this: XSLT (Extensible Style Language: Transformations). XSLT is transformation language that can be used to convert an XML document into another form:
  • HTML
  • XML in a different format XSLT is a declarative, transformational language
  • uses rules (instead of a procedure)
  • transforms input document into an output document XSLT uses a stylesheet to define the rules. Let's look at an example that transforms a customerList XML file into some HTML: Look at customerlist.dtd, Example.XML, and CustomerList-StyleSheet.xsl. The XSLT processor copies the stylesheet until it finds a command (marked with "<xsl:"). These are the rules that tell it how to transform the document. For example, the command that starts with: <xsl:for each select = "customerlist/customer">
  • artStyle is defined as an attribute instead of as an element.
  • the schema is referenced at the top of the document. Schemas can be flat or structured. A flat schema has all elements at the same level. Slide 3 – an example of a flat schema. Optional elements have minOccur = 0. Note that the elements have data types in this example. Slide 4 – an example XML document that is schema-valid. Slide 5 – a diagram showing the structure. Note that optional elements are shown dashed. In Slide 4, there is no country. If we think about this data carefully, we can see that we've left some of the semantics out. Things like street, city, zip make up an Address. Area code and phone number go together also. We'd like to capture this structure. Structured types have multiple levels that allow us to do this. Slide 6 – Example schema with PhoneType and AddressType Slide 7 – XML document that uses this schema Slide 8 – Graphical representation Doing this also allows us to avoid duplicate definitions – we can use these types in multiple locations. For example, a customer and a salesperson both have phone numbers. See slides 9, 10 and 11. OK, so we can see how to represent data in XML form. The schema tells us what the data looks like, the XML documents tell us what the data is, and we can use XSLT to transform XML documents from one form to another. So, how do we get data in/out of databases into XML? Well, this is pretty new stuff, but we can look at a bit of it with SQL Server. The select statement includes a FOR XML clause. Let's look at some examples: [See my other notes, use SQL Server] Other techniques: ADO.net (see slide 12) SQL/XML
  • allows you to store XML data directly in database, and validate it using CHECK constraints. Finally, lots of industries are using this. See slides 13 and 14.