Your SlideShare is downloading. ×
Xml 20111006 hurd
Xml 20111006 hurd
Xml 20111006 hurd
Xml 20111006 hurd
Xml 20111006 hurd
Xml 20111006 hurd
Xml 20111006 hurd
Xml 20111006 hurd
Xml 20111006 hurd
Xml 20111006 hurd
Xml 20111006 hurd
Xml 20111006 hurd
Xml 20111006 hurd
Xml 20111006 hurd
Xml 20111006 hurd
Xml 20111006 hurd
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 20111006 hurd

135

Published on

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

  • Be the first to like this

No Downloads
Views
Total Views
135
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
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. Introduction to XMLWENDY HAGENMAIER & CARIS HURD FALL 2011The Machine is Us/ing Us
  • 2. What is XML?•  stands for “eXtensible Markup Language”•  is a language for documents containing structured information •  structured information – contains both content (words, pictures, etc.) and some indication of what role that content plays • XML vs. HTML: XML was designed to transport and store data. HTML was designed to display data.
  • 3. Tags?! What are those?<?xml version= “1.0”?><example><quote type=“movie”>The dude abides.</quote></example>
  • 4. More info<?xml version= “1.0”?><example><quote>The dude abides.</quote></example> F. I. L. O. First In Last Out
  • 5. We’ve got the M, Let’s return to the X X stands for “extensible” in XML – remember?•  Extensible means there is NO predefined tag set•  XML is pretty general, in that it allows users to define their own tags and the relationships between them
  • 6. DTDs Make Rules for Tags•  Without rules, your document and tags will be worthless to others•  Rules are set with a DTD DTD = Document Type DefinitionYour DTD defines all kinds of things! •  what tags can be nested inside of other tags •  what kind of information can be stored inside certain tags
  • 7. Sample DTD #1<?xml version =“1.0” encoding=“US-ASCII”?>… Parent and Child Elements our XML declaration statement ¡  Child elements are the only ones that can be nested inside of Parent elements ¡  An example of DTD’s rule making abilities!<!DOCTYPE customerorder [ Parent = Customer<!ELEMENT Customer (Name, Email)> ¡  Children =<!ELEMENT Name (#PCDATA)> ÷  Name<!ELEMENT Email (#PCDATA)> ÷  Email<!ELEMENT Physical Address (street, unit#*, city, state, zipcode)><!ELEMENT street (#PCDATA)><!ELEMENT unit# (#PCDATA)><!ELEMENT city (#PCDATA)><!ELEMENT state (#PCDATA)><!ELEMENT zipcode (#PCDATA)><!ELEMENT Shipment (ShipDate, ShipMode)><!ELEMENT ShipDate (#PCDATA)><!ELEMENT ShipMode (#PCDATA)>]>
  • 8. Sample DTD #2<!DOCTYPE TVSCHEDULE [<!ELEMENT TVSCHEDULE (CHANNEL+)><!ELEMENT CHANNEL (BANNER,DAY+)><!ELEMENT BANNER (#PCDATA)><!ELEMENT DAY (DATE,(HOLIDAY | PROGRAMSLOT+)+)><!ELEMENT HOLIDAY (#PCDATA)><!ELEMENT DATE (#PCDATA)><!ELEMENT PROGRAMSLOT (TIME,TITLE,DESCRIPTION?)><!ELEMENT TIME (#PCDATA)><!ELEMENT TITLE (#PCDATA)><!ELEMENT DESCRIPTION (#PCDATA)><!ATTLIST TVSCHEDULE NAME CDATA #REQUIRED><!ATTLIST CHANNEL CHAN CDATA #REQUIRED><!ATTLIST PROGRAMSLOT VTR CDATA #IMPLIED><!ATTLIST TITLE RATING CDATA #IMPLIED><!ATTLIST TITLE LANGUAGE CDATA #IMPLIED>]>
  • 9. Element Type DeclarationsElement Type Declaration DefinitionEMPTY No content allowedANY Any content alloweda,b Specific order (a, followed by b)X|Y Either/or (X or Y)a,b,(X|Y) Groups (a, then b, then X or Y)* Zero or more elements allowed+ One or more elements allowed? Zero or one element allowed One and only one allowed#PCDATA Parsed character data
  • 10. Sample DTD #2 (again)<!DOCTYPE TVSCHEDULE [<!ELEMENT TVSCHEDULE (CHANNEL+)><!ELEMENT CHANNEL (BANNER,DAY+)><!ELEMENT BANNER (#PCDATA)><!ELEMENT DAY (DATE,(HOLIDAY | PROGRAMSLOT+)+)><!ELEMENT HOLIDAY (#PCDATA)><!ELEMENT DATE (#PCDATA)><!ELEMENT PROGRAMSLOT (TIME,TITLE,DESCRIPTION?)><!ELEMENT TIME (#PCDATA)><!ELEMENT TITLE (#PCDATA)><!ELEMENT DESCRIPTION (#PCDATA)><!ATTLIST TVSCHEDULE NAME CDATA #REQUIRED><!ATTLIST CHANNEL CHAN CDATA #REQUIRED><!ATTLIST PROGRAMSLOT VTR CDATA #IMPLIED><!ATTLIST TITLE RATING CDATA #IMPLIED><!ATTLIST TITLE LANGUAGE CDATA #IMPLIED>]>
  • 11. Attribute ListAttribute example in XML: <example> <quote type=“movie”>The dude abides.</quote> </example>Attribute example defined in DTD: <!ELEMENT quote (#PCDATA)> <!ATTLIST quote type CDATA #REQUIRED>
  • 12. Now let’s try doing it! http://tinyurl.com/3r5o9y2 1.  Download two files to your desktop2.  Save them in a new folder called “xml_practice”3.  Open them in Oxygen
  • 13. XSD versus DTD
  • 14. Applying XMLEAD!•  stands for Encoded Archival Description•  is a XSD (but all the rules are already made for you!)•  started in 1993 as part of The Berkeley Project at the Univ. of California –Berkeley•  based on commonalities between finding aids sent in by archivists around theworld•  The prototype of EAD was released on February 26,1996!•  Today the official EAD standards are maintained by The Library of Congressand the Society of American Archivists.•  If you’re in Archival Enterprise I and have any questions about the EADassignment, feel free to come to the lab and ask us questions! http://www.loc.gov/ead/ http://www.archivists.org/saagroups/ead/
  • 15. Applying XML (cont’d)There are hundreds, but just to name a few…•  XHTML http://www.w3.org/TR/xhtml1/•  CML http://www.xml-cml.org/•  WML http://www.openmobilealliance.org/Technical/wapindex.aspx•  ThML http://www.ccel.org/ThML/•  WebML http://webml.org/webml/page1.do•  LegalXML http://www.legalxml.org/committees/index.shtml•  Text Encoding Initiative (TEI): http://www.tei-c.org/index.xml
  • 16. Resources•  http://www.w3.org/XML/•  http://www.w3schools.com/xml/default.asp•  http://www.w3schools.com/dtd/default.asp•  http://www.tizag.com/xmlTutorial/•  http://www.loc.gov/ead/•  http://www.archivists.org/saagroups/ead/•  XML syntax validator: http://www.w3schools.com/xml/xml_validator.asp•  More about ATTLIST: http://www.w3schools.com/dtd/dtd_attributes.asp

×