7. CSV cont…
1997 Ford
E350
1999 Chevy
Venture "Extended
Edition"
1996 Jeep
Grand Cherokee
ac, abs, moon
3000.00
4900.00
MUST SELL! air
- moon roof loaded
4799.00
8. ?
01041cam 2200265 a 450000100200000000300040002000
50017000240080041000410100024000820200025001060200
04400131040001800175050002400193082001800217100003
20023524500870026724600360035425000120039026000370
04023000029004395000042004685200220005106500033007
30650001200763^###89048230#/AC/r91^DLC^19911106082
810.9^891101s1990####maua###j######000#0#eng##^##$
a###89048230#/AC/r91^##$a0316107514 :$c$12.95^##$a 0316107506 (pbk.) :
$c$5.95 ($6.95 Can.)^##$aDLC$cD LC$dDLC^00$aGV943.25$b.B74
1990^00$a796.334/2$220^ 10$aBrenner, Richard J.,$d1941-^10$aMake the
team. $pSoccer :$ba heads up guide to super soccer! /$cR ichard J.
Brenner.^30$aHeads up guide to super soccer.^##$a1st ed.^##$aBoston :
$bLittle, Brown,$cc19 90.^##$a127 p. :$bill. ;$c19 cm.^##$a"A Sports ill ustrated
for kids book."^##$aInstructions for improving soccer skills. Discusses dribbling,
heading, playmaking, defense, conditioning, mental attitud e, how to handle
problems with coaches, parents, and other players, and the history of
soccer.^#0$aS occer$vJuvenile literature.^#1$aSoccer.^
9. MARC
01041cam 2200265 a 450000100200000000300040002000
50017000240080041000410100024000820200025001060200
04400131040001800175050002400193082001800217100003
20023524500870026724600360035425000120039026000370
04023000029004395000042004685200220005106500033007
30650001200763^###89048230#/AC/r91^DLC^19911106082
810.9^891101s1990####maua###j######000#0#eng##^##$
a###89048230#/AC/r91^##$a0316107514 :$c$12.95^##$a 0316107506 (pbk.) :
$c$5.95 ($6.95 Can.)^##$aDLC$cD LC$dDLC^00$aGV943.25$b.B74
1990^00$a796.334/2$220^ 10$aBrenner, Richard J.,$d1941-^10$aMake the
team. $pSoccer :$ba heads up guide to super soccer! /$cR ichard J.
Brenner.^30$aHeads up guide to super soccer.^##$a1st ed.^##$aBoston :
$bLittle, Brown,$cc19 90.^##$a127 p. :$bill. ;$c19 cm.^##$a"A Sports ill ustrated
for kids book."^##$aInstructions for improving soccer skills. Discusses dribbling,
heading, playmaking, defense, conditioning, mental attitud e, how to handle
problems with coaches, parents, and other players, and the history of
soccer.^#0$aS occer$vJuvenile literature.^#1$aSoccer.^
11. ?
:p.Here's an example of some BASIC statements:
:xmp.
10 PRINT USING 55 A, B, C
20 LET J = K + 2
30 IF J = X GO TO 80
:exmp.
:pc.that will solve this problem.
:fig place=inline width=page frame=box. AN INLINE, PAGE-WIDE FIGURE Because the
contents of a figure format EXACTLY as entered, you can enter blanks on the line (before
text) and the lines will print exactly the same as they were entered!
:figcap. An Inline, Page-Wide Figure
:figdesc. This is the first figure I have entered myself.
:efig.
:p.This paragraph follows the FIG end tag. Here we have another figure (inline and column
wide):
:fig place=inline width=column. Let's create another figure that is column wide, which will
create a second item for a list of illustrations in a future exercise.
:figcap. A Column-Wide Figure
:efig.
12. GML
:p.Here's an example of some BASIC statements:
:xmp.
10 PRINT USING 55 A, B, C
20 LET J = K + 2
30 IF J = X GO TO 80
:exmp.
:pc.that will solve this problem.
:fig place=inline width=page frame=box. AN INLINE, PAGE-WIDE FIGURE Because the
contents of a figure format EXACTLY as entered, you can enter blanks on the line (before
text) and the lines will print exactly the same as they were entered!
:figcap. An Inline, Page-Wide Figure
:figdesc. This is the first figure I have entered myself.
:efig.
:p.This paragraph follows the FIG end tag. Here we have another figure (inline and column
wide):
:fig place=inline width=column. Let's create another figure that is column wide, which will
create a second item for a list of illustrations in a future exercise.
:figcap. A Column-Wide Figure
:efig.
17. XML - 2
Is for structuring data
Is derived from SGML/HTML
Is text, but isn’t meant to be read
Is verbose by design
18. Basic Syntax of XML
All XML elements must have a closing tag
Empty elements must close with /
XML tags are case sensitive
All XML elements must be properly nested
All XML documents must have a root element
Attribute values must always be quoted
XML entities must be used for special
characters
19. Special Characters in XML
strings
&
<
>
"
'
- &
- <
- >
- "
- '
21. XML Structure
<?xml version="1.0" encoding="utf-8"
Prolog.(optional)
standalone="no"?>
<?xml-stylesheet type="text/css“
href="xmlstyle.css"?>
<bookstore xml:lang="en-US“
xmlns:def="Definitions“>
<book id=“1”>The Bible</book>
…
</bookstore>
Processing
Instruction (optional)
Document Element
(namespace/s)
Child node/s
Closing tag of
Document Element
22. XML Example
<?xml version="1.0" encoding="UTF-8"?>
<Recipe name="bread" prep_time="5 mins" cook_time="3 hours">
<title>Basic bread</title>
<ingredient amount="3" unit="cups">Flour</ingredient>
<ingredient amount="0.25" unit="ounce">Yeast</ingredient>
<ingredient amount="1.5" unit="cups“ state="warm">Water</ingredient>
<ingredient amount="1" unit="teaspoon">Salt</ingredient>
<Instructions>
<step>Mix all ingredients together, and knead thoroughly.</step>
<step>Cover with a cloth, and leave for one hour in warm room.</step>
<step>Knead again, place in a tin, and then bake in the oven.</step>
</Instructions>
</Recipe>
24. Attributes vs Elements
Data can be stored in child elements or in attributes.
<person sex="female">
<fname>Anna</fname>
<lname>Smith</lname>
</person>
<person>
<sex>female</sex>
<fname>Anna</fname>
<lname>Smith</lname>
</person>
35. Take Home …
XML is a syntax for marking up data
Markup tags are not pre-defined
Namespaces make identical tag names
unique
An XML instance document is made up
of markup tags and text (data)
XML documents are tree structures
36.
37. XPath
language for addressing part/s of an
XML document
designed to be used by XSLT
models XML document as tree of nodes
fully supports XML Namespaces
50. XML Schema Defines …
Content
Structure
elements & attributes
parent-child relationships
order of child elements
number of child elements
Constraints
whether an element is empty or can include text
data types for elements and attributes
default/fixed values for elements & attributes
51. Example: Simple XML File
<?xml version="1.0"?>
<note>
<to>Peter</to>
<from>Clare</from>
<heading>Reminder</heading>
<body>Don't forget the pub this
weekend!</body>
</note>
53. Schema components [1]
The <schema> element
<?xml version="1.0"?>
<xs:schema …..
... ...
</xs:schema>
54. Schema components [2]
Simple element
can contain only text. It cannot contain any
other elements or attributes.
<xs:element name="to" type="xs:string"/>
60. Regular Expressions
Wildcards on steroids
ab|c{2}|de
“ab”; “cc”; “de”
[A-Z]{1,4}
“ABDS”; “A”; “ZXS”
[1970-2030]
e.g. years in range
[A-Z]{1,2}[0-9R][0-9AZ]? [0-9][A-Z]{2}
Post Codes
62. Complex Element
contains other elements and/or attributes.
[4 kinds]
1)
2)
3)
4)
empty elements
elements that contain only other elements
elements that contain only text
elements that contain both other elements
and text
63. Complex Element examples
a)
b)
c)
<product pid="1345"/>
<employee>
<firstname>John</firstname>
<lastname>Smith</lastname>
</employee>
<food type="dessert">Ice cream</food>
65. Complex Element Definition /2
Reference to complex type
<xs:element name="employee" type="personinfo"/>
<xs:complexType name="personinfo">
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
</xs:sequence>
</xs:complexType>
66. Type Reuse
Several elements based on same type
<xs:element name="employee" type="personinfo"/>
<xs:element name="student" type="personinfo"/>
<xs:element name="member" type="personinfo"/>
68. Indicators
Seven type of indicators enable composition
Order indicators:
Occurrence indicators:
All
Choice
Sequence
maxOccurs
minOccurs
Group indicators:
Group name
attributeGroup name
69. <any>
The <any> element enables us to
extend the XML document with
elements not specified by the schema.
The <anyAttribute> element enables us
to extend the XML document with
attributes not specified by the schema.
70. Where’s the beef?
XML Schema permits…
Standard libraries of data specifications
Formal specification of data models
Automated validation of XML instance
files based on XML Schema
Simplified creation of structured
documents
80. Benefits of the XML route
Open Standards
Vendor Neutral
e-GIF/OSIAF compliant
Very flexible – one source, many uses
81. Problems with the XML route
XML files tend to be large
DOM (Drudgery Object Model)
Inter-record linking & validation across
records is not trivial
Many tools are not mature (but this
situation is improving rapidly.)
84. XML Schemas
Model the data items (UML?)
Isolate common data definitions
Prepare Schemas
Disambiguate using namespaces
Validate model
QA Schemas for compliance with
standards (automated)
Restrictions for Datatypes
Enumeration : Defines a list of acceptable values
fractionDigits : Specifies the maximum number of decimal places allowed. Must be equal to or greater than zero
Length : Specifies the exact number of characters or list items allowed. Must be equal to or greater than zero
maxExclusive : Specifies the upper bounds for numeric values (the value must be less than this value)
maxInclusive : Specifies the upper bounds for numeric values (the value must be less than or equal to this value)
maxLength : Specifies the maximum number of characters or list items allowed. Must be equal to or greater than zero
minExclusive : Specifies the lower bounds for numeric values (the value must be greater than this value)
minInclusive: Specifies the lower bounds for numeric values (the value must be greater than or equal to this value)
minLength: Specifies the minimum number of characters or list items allowed. Must be equal to or greater than zero
Pattern : Defines the exact sequence of characters that are acceptable
totalDigits : Specifies the exact number of digits allowed. Must be greater than zero
whiteSpace : Specifies how white space (line feeds, tabs, spaces, and carriage returns) is handled
Order indicators are used to define how elements should occur.
The <all> indicator specifies by default that the child elements can appear in any order and that each child element must occur once and only once: The <choice> indicator specifies that either one child element or another can occur:
The <sequence> indicator specifies that the child elements must appear in a specific order:
Occurrence indicators are used to define how often an element can occur.
The <maxOccurs> indicator specifies the maximum number of times an element can occur:
The <minOccurs> indicator specifies the minimum number of times an element can occur:
Group indicators are used to define related sets of elements.