This document provides an overview of SGML and XML. It describes SGML as a metalanguage that uses start and end tags along with elements that can contain other subelements in a hierarchical structure. XML is described as a type of SGML that is easier to process due to requiring end tags and other simplified features. Examples are given of how MARC21 records can be encoded in both SGML and XML formats. The development of XML by the W3C and alternatives to DTDs like XML Schema are also summarized.
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Sgml and xml
1. SGML and XMLSGML and XML
Richard Sapon-White
Introduction to Metadata
May 13, 2013
2. SGMLSGML
Standardized General Markup Language, a
metalanguage
DTD (Document Type Definition) –
identifies the scheme used to define tags
and the rules for using them
DTDs: EAD, HTML, DTD for MARC21
2
3. SGML (cont.)SGML (cont.)
Uses start and end tags; attribute names
and values
Elements may include text, text +
attribute, attribute
Elements (wrappers) may include other
elements (subelements)
3
4. SGML Advantages and DisadvantagesSGML Advantages and Disadvantages
Advantages
◦ Element names can be mnemonic, e.g. EAD
element <titleproper> (compare with 245 $a)
◦ Hierarchical: can inherit data encoded at
higher levels
Disadvantage
◦ Difficult for programs to process; software
applications are complex
4
5. XMLXML
Type of SGML with fewer features and
options, for example:
◦ End tags must be used
◦ Attribute values always in quotation marks
Easier to process
◦ Tags are case-sensitive
◦ Attributes may contain UNICODE characters
5
6. Examples: LC DTD for MARC21Examples: LC DTD for MARC21
<mrcb245 i1=0 i2=4><mrcb245-a>The
health of dairy cattle /<mrcb245-c>edited
by Anthony H. Andrews. [SGML]
<mrcb245 i1=“0” i2=“4”><mrcb245-
a>The health of dairy cattle/</mrcb245-
a><mrcb245-c>edited by Anthony H.
Andrews.</mrcb245-c></mrcb245>
[XML]
6
7. XML DevelopmentXML Development
World Wide Web Consortium (W3C)
actively developing XML
XML linking language, query language,
stylesheet language, etc.
XML Schema are an alternative to DTDs
LC has developed MARCXML, an XML
Schema for MARC21 records
7
8. XML: TodayXML: Today
The language of the Web
Web browsers and other applications
support XML-encoded documents
8
Editor's Notes
SGML describes the syntax for encoding documents, but not specific tags.