SlideShare ist ein Scribd-Unternehmen logo
1 von 16
Downloaden Sie, um offline zu lesen
Introduction to XML

WENDY HAGENMAIER & CARIS HURD
          FALL 2011




The Machine is Us/ing Us
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.
Tags?! What are those?



<?xml version= “1.0”?>
<example>
<quote type=“movie”>The dude abides.</quote>
</example>
More info

<?xml version= “1.0”?>
<example>
<quote>The dude abides.</quote>
</example>



  F. I. L. O.
  First
  In
  Last
  Out
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
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 Definition

Your 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
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)>

]>
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>

]>
Element Type Declarations

Element Type Declaration   Definition
EMPTY                      No content allowed
ANY                        Any content allowed
a,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
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>

]>
Attribute List


Attribute 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>
Now let’s try doing it!
                   http://tinyurl.com/3r5o9y2 


1.  Download two files to your
    desktop
2.  Save them in a new folder
    called “xml_practice”
3.  Open them in Oxygen
XSD versus DTD
Applying XML

EAD!
•  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 the
world
•  The prototype of EAD was released on February 26,1996!
•  Today the official EAD standards are maintained by The Library of Congress
and the Society of American Archivists.
•  If you’re in Archival Enterprise I and have any questions about the EAD
assignment, feel free to come to the lab and ask us questions!

                          http://www.loc.gov/ead/
                  http://www.archivists.org/saagroups/ead/
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
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

Weitere ähnliche Inhalte

Was ist angesagt? (20)

01 xml document structure
01 xml document structure01 xml document structure
01 xml document structure
 
Difference between dtd and xsd
Difference between dtd and xsdDifference between dtd and xsd
Difference between dtd and xsd
 
Tp2
Tp2Tp2
Tp2
 
02 xml schema
02 xml schema02 xml schema
02 xml schema
 
XSD
XSDXSD
XSD
 
XML DTD and Schema
XML DTD and SchemaXML DTD and Schema
XML DTD and Schema
 
XML DTD DOCUMENT TYPE DEFINITION
XML DTD DOCUMENT TYPE DEFINITIONXML DTD DOCUMENT TYPE DEFINITION
XML DTD DOCUMENT TYPE DEFINITION
 
Document Type Definitions
Document Type DefinitionsDocument Type Definitions
Document Type Definitions
 
2 dtd - validating xml documents
2   dtd - validating xml documents2   dtd - validating xml documents
2 dtd - validating xml documents
 
XML Schema
XML SchemaXML Schema
XML Schema
 
NISO/NFAIS Joint Virtual Conference: Connecting the Library to the Wider Worl...
NISO/NFAIS Joint Virtual Conference: Connecting the Library to the Wider Worl...NISO/NFAIS Joint Virtual Conference: Connecting the Library to the Wider Worl...
NISO/NFAIS Joint Virtual Conference: Connecting the Library to the Wider Worl...
 
XML, DTD & XSD Overview
XML, DTD & XSD OverviewXML, DTD & XSD Overview
XML, DTD & XSD Overview
 
Xsd examples
Xsd examplesXsd examples
Xsd examples
 
Xml dtd- Document Type Definition- Web Technology
Xml dtd- Document Type Definition- Web TechnologyXml dtd- Document Type Definition- Web Technology
Xml dtd- Document Type Definition- Web Technology
 
XML Schemas
XML SchemasXML Schemas
XML Schemas
 
Xml dtd
Xml dtdXml dtd
Xml dtd
 
NoSQL Search Roadshow Zurich 2013 - Polyglot persistence with no sql
NoSQL Search Roadshow Zurich 2013 - Polyglot persistence with no sqlNoSQL Search Roadshow Zurich 2013 - Polyglot persistence with no sql
NoSQL Search Roadshow Zurich 2013 - Polyglot persistence with no sql
 
Document type definition
Document type definitionDocument type definition
Document type definition
 
XXE
XXEXXE
XXE
 
Xxe
XxeXxe
Xxe
 

Andere mochten auch

Repurposing EAD (Encoded Archival Description)
Repurposing EAD (Encoded Archival Description)Repurposing EAD (Encoded Archival Description)
Repurposing EAD (Encoded Archival Description)Michael Rush
 
Linked data for librarians
Linked data for librariansLinked data for librarians
Linked data for librarianstrevorthornton
 
EAD Revision Progress Report, SAA 2013
EAD Revision Progress Report, SAA 2013EAD Revision Progress Report, SAA 2013
EAD Revision Progress Report, SAA 2013Michael Rush
 
EAD Revision Progress Report, 2012-08-08
EAD Revision Progress Report, 2012-08-08EAD Revision Progress Report, 2012-08-08
EAD Revision Progress Report, 2012-08-08Michael Rush
 
Third Time's the Charm: Thoughts on an EAD Revision
Third Time's the Charm: Thoughts on an EAD RevisionThird Time's the Charm: Thoughts on an EAD Revision
Third Time's the Charm: Thoughts on an EAD RevisionMichael Rush
 
EAD Version 3: Possible Outcomes
EAD Version 3: Possible OutcomesEAD Version 3: Possible Outcomes
EAD Version 3: Possible OutcomesMichael Rush
 

Andere mochten auch (9)

Ead eac ukad_forum_2011
Ead eac ukad_forum_2011Ead eac ukad_forum_2011
Ead eac ukad_forum_2011
 
Repurposing EAD (Encoded Archival Description)
Repurposing EAD (Encoded Archival Description)Repurposing EAD (Encoded Archival Description)
Repurposing EAD (Encoded Archival Description)
 
Linked data for librarians
Linked data for librariansLinked data for librarians
Linked data for librarians
 
Using EAC-CPF
Using EAC-CPFUsing EAC-CPF
Using EAC-CPF
 
EAD Revision Progress Report, SAA 2013
EAD Revision Progress Report, SAA 2013EAD Revision Progress Report, SAA 2013
EAD Revision Progress Report, SAA 2013
 
EAD Revision Progress Report, 2012-08-08
EAD Revision Progress Report, 2012-08-08EAD Revision Progress Report, 2012-08-08
EAD Revision Progress Report, 2012-08-08
 
Third Time's the Charm: Thoughts on an EAD Revision
Third Time's the Charm: Thoughts on an EAD RevisionThird Time's the Charm: Thoughts on an EAD Revision
Third Time's the Charm: Thoughts on an EAD Revision
 
EAD Version 3: Possible Outcomes
EAD Version 3: Possible OutcomesEAD Version 3: Possible Outcomes
EAD Version 3: Possible Outcomes
 
Schema and Identity for Linked Data
Schema and Identity for Linked DataSchema and Identity for Linked Data
Schema and Identity for Linked Data
 

Ähnlich wie Xml 20111006 hurd

Ähnlich wie Xml 20111006 hurd (20)

it8074-soa-uniti-.pdf
it8074-soa-uniti-.pdfit8074-soa-uniti-.pdf
it8074-soa-uniti-.pdf
 
It8074 soa-unit i
It8074 soa-unit iIt8074 soa-unit i
It8074 soa-unit i
 
2-DTD.ppt
2-DTD.ppt2-DTD.ppt
2-DTD.ppt
 
Unit iv xml
Unit iv xmlUnit iv xml
Unit iv xml
 
23xml
23xml23xml
23xml
 
Xml sasidhar
Xml  sasidharXml  sasidhar
Xml sasidhar
 
Xml
XmlXml
Xml
 
Xml
XmlXml
Xml
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Xml Lecture Notes
Xml Lecture NotesXml Lecture Notes
Xml Lecture Notes
 
Xml schema
Xml schemaXml schema
Xml schema
 
Test for an issue
Test for an issueTest for an issue
Test for an issue
 
Chen test paper20abcdeftfdfd
Chen test paper20abcdeftfdfdChen test paper20abcdeftfdfd
Chen test paper20abcdeftfdfd
 
Chen's first test slides
Chen's first test slidesChen's first test slides
Chen's first test slides
 
distributed system concerned lab sessions
distributed system concerned lab sessionsdistributed system concerned lab sessions
distributed system concerned lab sessions
 
Unit 5 xml (1)
Unit 5   xml (1)Unit 5   xml (1)
Unit 5 xml (1)
 
Xml and DTD's
Xml and DTD'sXml and DTD's
Xml and DTD's
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
XML for beginners
XML for beginnersXML for beginners
XML for beginners
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 

Xml 20111006 hurd

  • 1. Introduction to XML WENDY HAGENMAIER & CARIS HURD FALL 2011 The 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 Definition Your 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 Declarations Element Type Declaration Definition EMPTY No content allowed ANY Any content allowed a,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 List Attribute 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 desktop 2.  Save them in a new folder called “xml_practice” 3.  Open them in Oxygen
  • 14. Applying XML EAD! •  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 the world •  The prototype of EAD was released on February 26,1996! •  Today the official EAD standards are maintained by The Library of Congress and the Society of American Archivists. •  If you’re in Archival Enterprise I and have any questions about the EAD assignment, 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