Presentation is loading. Please wait.

Presentation is loading. Please wait.

XML A Single Entity. xml a single entity Objectives Objectives :  understand the data model  describe the XML Document  describe the XML Schema  describe.

Similar presentations


Presentation on theme: "XML A Single Entity. xml a single entity Objectives Objectives :  understand the data model  describe the XML Document  describe the XML Schema  describe."— Presentation transcript:

1 XML A Single Entity

2 xml a single entity Objectives Objectives :  understand the data model  describe the XML Document  describe the XML Schema  describe the XML Stylsheet (XSL)

3 the data model WineStore Wine wineID winery style vintage country region cost price inventory description

4 xml Document  XML - a markup language capable of describing many different kinds of data  primary purpose - to facilitate the sharing of data across different systems  defined in a formal way  allows programs to modify and validate documents without prior knowledge of their form picked out from Wikipedia

5 xml schema  an XML Document  provides a template for an XML Document  governs the structure and content  ensures validity of an XML Document  confidence in data transfer

6 xml Stylesheet  eXtensible Stylesheet Language (XSL)  allows for the structured format of the XML Document to be presented visually  allows for a single XML document to have a variety of display designs

7 xml Document Prolog (XML Declaration) Elements Attributes Rules to follow Well-formed XML documents

8 1 Ravenswood Zinfandel 2003 United States Sonoma County, California 12.50 20.75 35 This 2003 Zinfandel has huge, jammy, inky, slightly porty aromas infused with black pepper, vanilla and hints of tar, smoke and coffee blend. A very broad, intense wine with huge fruit, lots of those luscious Dry Creek bing cherry and sweet plum characters. prolog root element parent element child element sibling elements

9 xml Document - prolog  basic XML Document: prolog = XML declaration  xml = this is an XML document  version="1.0" = XML 1.0 is the W3C recommend version  encoding="UTF-8" = the character encoding used in the document (UTF 8 corresponds to 8-bit ASCII characters) back

10 xml Document - root element ….  the XML document's major theme  must have exactly one and only one root element  all other elements are contained within the one root element  follows the XML declaration back

11 xml Document - parent element ….  any element that contains other elements, child elements  is also a parent element with as its child element  an element can be a parent element to some elements as well as a child element to another element back

12 xml Document - child element ….  any element that is contained within another element, the parent element  is a child element of ,,,, etc. are all also child elements of back

13 xml Document - sibling elements  any elements that share a common parent element ,,,,,,,,, and are all sibling elements

14 xml Document - elements data (empty tag or empty element) (example: )

15 xml Document - attributes aid in modifying the content of a given element provide additional or required information contained within the element's opening tag 7.50

16 xml Document - Rules  first line = XML Declaration  root element contains all other elements  every element must have an opening tag and a closing tag  attribute values should have quotation marks around them and no spaces  empty tags or empty elements must have a space and a slash (/) at the end of the tag  Comments in the XML language begin with " " well-formed XML - abides by rules of syntax

17 NetBeans select ‘New Project’

18

19

20 right click on the newly created project select a new XML document you can also select file/folder and choose XML => XML document

21

22 if we had already written an XML schema but, we will first just write an XML Document

23 the start of an XML document - note the.xml extension

24 xml schema Prolog Element Declarations Simple Type Complex Type Attribute Declarations Datatype Declarations Valid XML documents

25 xml schema A schema defines: the structure of the document the elements the attributes the child elements the order of elements the names and contents of all elements the data type for each element

26 xml schema - prolog the XML declaration: the Schema declaration: (from chapter) <xsd:schema xmlns:xsd=http://www.w3.org/2001/XMLSchema elementFormDefault="unqualified“> (from NetBeans) <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="http://xml.netbeans.org/examples/targetNS" targetNamespace="http://xml.netbeans.org/examples/targetNS" xmlns=http://xml.netbeans.org/examples/targetNS elementFormDefault="qualified">

27 xml schema - element declarations define the elements in the schema include: the element name the element data type (optional) basic element declaration format:

28 xml schema - element declarations Two types: Simple Type do NOT have Child Elements do NOT have Attributes Complex Type can have Child Elements can have Attributes

29 xml schema - Complex type - child elements

30 xml schema - Complex type - attributes

31 minOccurs = "1" maxOccurs="unbounded" Occurrence Indicators: - minOccurs = the minimum number of times an element can occur (here it is 1 time) - maxOccurs = the maximum number of times an element can occur (here it is an unlimited number of times, 'unbounded')

32 <wineStore xmlns:xsi='http://www.w3.org/2001/XM LSchema-instance' xsi:schemaLocation='http://xml.netbeans. org/examples/targetNS file:/ C:/Documents and Settings/Viji Kannan/Desktop/TheWineStore/wineStor eSchema.xsd'> these attributes are added to the root element in the XML document xml schema - Reference

33 xml stylesheet (xsl) a means to transform and format the contents of an XML document for display separates the data and the presentation logic multiple views of the same data can be created using different stylesheets

34 node tree – a hierarchical representation of the entire XML document – each node represents a piece of the XML document, such as an element, attribute or some text content contains predefined “templates” that contain instructions on what to do with the nodes uses the match attribute to relate XML element nodes to the templates, and transform them into the resulting document. xml stylesheet (xsl)

35 XSL - prolog the XML declaration the stylesheet declaration the namespace declaration the output document format

36 XSL - templates the element is used to create templates that describe how to display elements and their content each template within an XSL describes a single node – to identify which node a given template is describing, use the 'match' attribute defines the start of a template and contains rules to apply when a specified node is matched

37

38


Download ppt "XML A Single Entity. xml a single entity Objectives Objectives :  understand the data model  describe the XML Document  describe the XML Schema  describe."

Similar presentations


Ads by Google