Markup Languages
Introduction to XML
Inforesources on XML
Resources on XML at Fl
XML document structure
Characters in XML documents
PB138 - Markup Languages
Tomas Pitner February 17, 2013
Markup Languages Introduction to XML Inforesources on XML Resources on XML at Fl XML document structure Characters in XML documents
Q| Markup Languages
0 Introduction to XML
0 Inforesources on XML
0 Resources on XML at Fl
0 XML document structure
0 Characters in XML documents
To i
Markup Languages
Introduction to XML
Inforesources on XML
Resources on XML at Fl
XML document structure
Characters in XML documents
What are Markup Languages?
• Formal (computer) languages that allow to use in addition to the normal text in natural languages also syntactically distinguishable constructs specifying the structure of the text, the meaning of parts, etc., and also allows the text to store its metadata (information about the origin, content, authorship, dating, rights used ...).
» Known markup languages ( markup languages ) are languages for web ( HTML, XML, ...), but also others such as typesetting formats of the TeX system, text
(documentation/help) formatting tools for the UNIX-like systems nroff, troff. Languages for page description for
printing and presentation, namely PostScript or PDF have similar characteristics (text + markup or commands).
To i
Markup Languages
Introduction to XML
Inforesources on XML
Resources on XML at Fl
XML document structure
Characters in XML documents
What are Markup Languages?
• Distinguishing characteristics of markup languages in comparison to programming languages is superiority of text (in natural language) over the rest of the content (markup, declarative), so files are often referred to as documents .
• The preponderance of the text in natural language may not be true in specific applications.
• For example, XML is used as the format of business exchange (database, table) data, where the marking more than text, and this has the character of a text-recorded data of other types (number, date, logical value).
To i
Markup Languages
Introduction to XML
Inforesources on XML
Resources on XML at Fl
XML document structure
Characters in XML documents
The Nature of Markup / 1
There are three main categories according to the nature of markup languages and method of their interpretation:
Presentational markup usually characterizes binary content
embedded in text, e.g. classical (older) formats for text editors.
Procedural markup indicating how the processor (processing
applications) deals with the text. Usually a sequence of instructions that the sections of the text are to perform. This sequence is consequtively processed while the usual programming constructs (branching, loops, subroutines, variables) are available. Ex.: TeX, PostScript.
To I
Markup Languages
Introduction to XML
Inforesources on XML
Resources on XML at Fl
XML document structure
Characters in XML documents
The Nature of Markup / 2
Descriptive markup declaratively defines the document structure and meaning of its parts and does not say exactly what step should be performed while processing -this is usually known by the applications. Ex.: HTML
To i
Markup Languages
Introduction to XML
Inforesources on XML
Resources on XML at Fl
XML document structure
Characters in XML documents
Tagging without computers
Around the sixties, the concept of tagging was known only in non-PC contexts:
• The first markup language (informally) were used to processing texts in books and their typesetting.
• Concealers and typographers make the markup on the edge of the paper to indicate what font to select, to make proofreading marks etc.
To i
Markup Languages Introduction to XML Inforesources on XML Resources on XML at Fl XML document structure Characters in XML documents
Early computer applications < of markup / 1
• The first systems for computerized text processing suffered from the fact that their target printing facilities were very different and hence they must have been "programmed".
• The standard GenCode (author William W. Tunnicliffe) was therefore developed, which allowed to mark the general (generic) print output in the text, and a special compiler customized the output for a particular output device.
• The "real father" of markup languages is often considered Charles Goldfarb from IBM, which developed early seventies the language IBM GML (http://en.wikipedia.org/wiki/ IBM_Generalized_Markup_Language).
To i
Markup Languages Introduction to XML Inforesources on XML Resources on XML at Fl XML document structure Characters in XML documents
Early computer applications < of markup / 2
• On the basis of these two languages was later SGML ( Standard Generalized Markup Language
(http://en.wikipedia.org/wiki/Standard_ Generalized_Markup_Language)) was created later, which in fact is not (one) language but a meta-language , ie. standard to define languages.
• A little different way was taken by the TeX markup language of Donald Knuth, 70s and Os, describing how a typesetting system should place text in a printed document. Frequently, a system of macros LaTeX (Leslie Lamport) is used instead, which adds descriptive / declarative character to TeX (for example, characterized the logical structure of the document).
To i
Markup Languages Introduction to XML Inforesources on XML Resources on XML at Fl XML document structure Characters in XML documents
Later markup standards - SGML
The first truly widespread and relatively widely applied (in scales, then, of course, incomparable with today's popularity XML ...) was SGML .
• It evolved as a modernization of GML, then followed by formalization and subsequent adoption as an ISO standard.
• It is a metalanguage, ie. rules for the design of specific markup languages, SGML instances.
To i
SGML
Markup Languages Introduction to XML Inforesources on XML Resources on XML at Fl XML document structure Characters in XML documents
Languages designed according to the rules of SGML are suitable for hand typing - there is less marking than later in XML. However, the existence of a DTD and connection to it to describe the structure of each document were compulsory.
SGML later, in the late 90 years, became the basis for formulation of XML as a format easier for machine processing, not necessarily requiring to describe the structure of documents for each file.
To i
Markup Languages
Introduction to XML
Inforesources on XML
Resources on XML at Fl
XML document structure
Characters in XML documents
What is XML?
• XML is a standard by the W3C (http://www.w3.org) consortium prescribing how to create markup languages.
• It is therefore a metalanguage.
• It is ideologically based on older standards (SGML Structure Generalized Markup Language) - XML can be seen as almost a subset of SGML.
• There are several other standards closely related to XML, such as XML Namespaces, Xlnclude, XML Base, XML Infoset.
• These standards together with others (XSLT, XSL-FO, XHTML, CSS ...) form a "family" of XML standards.
To i
Markup Languages Introduction to XML Inforesources on XML Resources on XML at Fl XML document structure Characters in XML documents
Ten principles for the XML standards / 1
from the preamble for XML 1.0 (Third Edition)
O XML shall be straightforwardly usable over the Internet. XML bude přímočaře použitelné na Internetu.
O XML shall support a wide variety of applications. XML bude podporovat širokou škálu aplikací.
O XML shall be compatible with SGML. XML bude kompatibilní se SGML.
To i
Markup Languages
Introduction to XML
Inforesources on XML
Resources on XML at Fl
XML document structure
Characters in XML documents
Ten principles for the XML standards / 2
from the preamble for XML 1.0 (Third Edition)
Q It shall be easy to write programs which process XML documents.
Tvorba programů zpracovávajících XML bude jednoduchá.
Q The number of optional features in XML is to be kept to the absolute minimum, ideally zero.
Počet volitelných prvků XML standardu bude málo, optimálně nula.
O XML documents should be human-legible and reasonably clear.
XML dokumenty by měly být "lidsky" čitelné a rozumně jednoduché.
Toi
Markup Languages
Introduction to XML
Inforesources on XML
Resources on XML at Fl
XML document structure
Characters in XML documents
Ten principles for the XML standards / 3
from the preamble for XML 1.0 (Third Edition)
O The XML design should be prepared quickly. Návrh XML standardu by měl být rychle hotov.
Q The design of XML shall be formal and concise. Návrh XML musí byt formální a správný.
Q XML documents shall be easy to create.
XML dokumenty bude možné snadno vytvořit.
O Terseness in XML literal is of minimal importance. Úspornost XML značkování není podstatná.
To i
Markup Languages
Introduction to XML
Inforesources on XML
Resources on XML at Fl
XML document structure
Characters in XML documents
Characteristics of XML languages / 1
• XML is not a specific markup language, it's a specification determining how the markup languages should look like,
• so it is a " meta-language",
• conceptually a simplification of the SGML standard to facilitate the creation of parsers (analyzers) and applications.
• As each element in an XML document must be closed, the documents need not have a DTD for structure recognition.
To i
Markup Languages Introduction to XML Inforesources on XML Resources on XML at Fl XML document structure Characters in XML documents
Characteristics of XML languages / 2
• XML builds on a successful implementation of SGML -HTML. It has similar characteristics in terms of the focus on the Internet.
• Serious discussions are held around binary XML, which should be equivalent representations of the same model as the "text" XML.
To i
Markup Languages Introduction to XML Inforesources on XML Resources on XML at Fl XML document structure Characters in XML documents
Current specifications of XML
• original specification (W3C Recommendation) to the W3C XML 1.0: http://www.w3.org/XML
• 5th Edition at Extensible Markup Language (XML) 1.0 (Fifth Edition) (http://www.w3.org/TR/REC-xml)
• XML 1.1 (Second Edition) (http://www.w3.org/TR/xmlll) - changes induced by the introduction of UNICODE 3 , easier normalization , the specification of handling procedure for "end of line" characters . XML 1.1 is not bound to specific version of UNICODE, but always on the latest version.
To I
Markup Languages Introduction to XML Inforesources on XML Resources on XML at Fl XML document structure Characters in XML documents
W3C Activities / 1
XML Coordination Group intermediateworking group, kind of
"interface" between different groups of activities and also externally
XML Core Working Group development of major specifications (XML ) and closely related ones ( Namespaces in XML, XML Information Set, Xlnclude )
Markup Languages Introduction to XML Inforesources on XML Resources on XML at Fl XML document structure Characters in XML documents
W3C Activities / 2
Efficient XML Interchange Working Group development of
standards for effective exchange of XML data with emphasis on portability and platform independence of the individual products (including eg Binary XML Characterization )
XML Processing Model Working Group working on the definition of a scripting language for XML, the specification operations over XML data
XML Linking Working Group the now defunct group worked on the development of XML Linking Language XLink) and XML Pointer Language (XPointer).
To i
Markup Languages Introduction to XML Inforesources on XML Resources on XML at Fl XML document structure Characters in XML documents
W3C Activities / 3
XML Query Working Group is designing the XML Query
Language ( XQuery and XPath - together with XSL Working Group)
XML Schema Working Group Prepares specifications of W3C XML Schema to describe the structure, content, or semantics of XML documents.
To i
What next?
Markup Languages Introduction to XML Inforesources on XML Resources on XML at Fl XML document structure Characters in XML documents
• Neither XML is an "ultimate solution" to all problems of machine data exchange. Development goes on.
• For interactive (rich) web applications (RIA) with intensive server-to-client communications, because of easier interpretability and smaller data, the formats such as JSON (JavaScript Object Notation) are used.
• YAML is used for handwriting structured data.
• These standards will be mentioned during lectures as well. The focus of the course is in XML, derived formats instruments for processing and applications.
To i
Markup Languages
Introduction to XML
Inforesources on XML
Resources on XML at Fl
XML document structure
Characters in XML documents
Tutorials and papers
• Zvon XML Tutorial: http://www.zvon.org/xxl/ XMLTutorial/General/book_en.html
» Tutorial ke XML na W3 Schools
(http://www.w3schools.com/xml/default.asp)
• Microsoft XML Tutorial:
http://msdn.microsoft.com/xml/tutorial/
• 101 XML Tutorials:
http://www.xml101.com/xml/default.asp
• XML Tutorials at Beginners.co.uk (http://tutorials.beginners.co.uk)
• Tutorials at Developerlife.com: http://developerlife.com
To i
Markup Languages Introduction to XML Inforesources on XML Resources on XML at Fl XML document structure Characters in XML documents
Portals on XML
World Wide Web Consortium (W3C) http://www.w3.org/ XML Startkabel http://xml.startkabel.nl - news, links
Zvon http://zvon.org - excellent collection of tutorials,
on-line references in many languages, hosted in CZ XML Cover Pages xml.coverpages.org
(http://xml.coverpages.org) - daily updated
collection of links to articles, standards, software, etc.
in XML. Best in this category. O'Reilly XML.COM http://xml.com - articles, tutorials at a
high level
IBM DeveloperWorks, sekce XML http://ibm.com/developer/xml (http://ibm.com/developer/xml/) - papers, tutorials, software atd. at a high level
To i
las Pitner PB138 - Markup Languages
Markup Languages
Introduction to XML
Inforesources on XML
Resources on XML at Fl
XML document structure
Characters in XML documents
Electronic confs, news, maiMists to XML
XML USENET newsgroup news:comp.text.xml
XML-DEV mailto:xml-dev@xml.org- best known maillist to XML standards (web archive
(http://lists.xml.org/archives/xml-dev/))
To i
Markup Languages Introduction to XML Inforesources on XML Resources on XML at Fl XML document structure Characters in XML documents
XML software
• IBM AlphaWorks: http://www.alphaworks.ibm.com-alpha-software from IBM to test for free
• Free XML Software (L. M. Garshol):
http://www.garshol.priv.no/download/xmltools/ -probably the best collection of links to non-commercial XML software
• XMLSoftware: http://xmlsoftware. com - includes also commercial SW
Markup Languages Introduction to XML Inforesources on XML Resources on XML at Fl XML document structure Characters in XML documents
More links to XML
• Activities of W3C: http://www.w3.org/XML/Activity-specification of standards, conferences, links to SW, reference tools, links
• What is XML? na XML.COM:
http://www.xml.com/pub/a/98/10/guide0.html - one of the intro articles to XML
• XML: XML Quick Syntax Reference Card (http://www.mulberrytech.com) - great, simple reference card
• Commented version of XML specification at XML.COM (Annotated XML):
http://www.xml.com/pub/a/axml/axmlintro.html
Markup Languages Introduction to XML Inforesources on XML Resources on XML at Fl XML document structure Characters in XML documents
Courses - Fall term
PA165 Enterprise Java - T. Pitner, P. Adámek, M. Kuba, F. Nguyen, P. Kunc, E. Kučírková a D. Tovarňák
PB029 Electronic document preparation - P. Sojka
PV110 Software electronic publications I - P. Sojka
PV173 Seminary of NLP Lab
To i
IB047 Intro to corpus linguistics and computer lexikography - K. Pala, P. Rychlý
PA105 Technologies of Information Systems II - J. Král
PA154 Corpus Tools - P. Rychlý
To i
PA156 Dialogue System - I. Kopeček
PV174 Lab of Electronic and Multimedia Apps - P. Sojka
PV030 Textual IS - P. Sojka
PV113 SW electronic publications II - P. Sojka
To i
Markup Languages
Introduction to XML
Inforesources on XML
Resources on XML at Fl
XML document structure
Characters in XML documents
XML document structure
Fundamental requirement to all XML doc: it must be well-formed:
O It contains prolog (heading) and exactly one root element.
Before and after the root element, there can be processing instructions, comments (Misc).
Q It meets all the well-formedness constraints given in the specification.
O Each of the parsed entities which is referenced directly or indirectly within the document is well-formed.
To i
Markup Languages
Introduction to XML
Inforesources on XML
Resources on XML at Fl
XML document structure
Characters in XML documents
XML document structure - further info
Look at tutorial on XML Fundamentals in English
(http://zvon.org/xxl/XMLTutorial/General/book.html)
ToC for XML (http://zvon.org/comp/rn/xml.html)
To i
Markup Languages Introduction to XML Inforesources on XML Resources on XML at Fl XML document structure Characters in XML documents
XML document structure
• XML document structure we distinguish between: physical and logical structure.
• Application programmers are usually interested just on the logical structure,
• while for the authors of content, XML editors, processors may also the physical structure be important.
To i
Markup Languages
Introduction to XML
Inforesources on XML
Resources on XML at Fl
XML document structure
Characters in XML documents
Physical and logical structure
Logical structure A document is divided into elements (one of them is the root), their attributes, text nodes in elements, processing instructions, notations, comments.
Physical structure One logical doc may be stored in one or more entities; at least in the document entity.
To i
Markup Languages
Introduction to XML
Inforesources on XML
Resources on XML at Fl
XML document structure
Characters in XML documents
Composition of logical structure
• node (element, attribute, text node, processing instructions, comments)
• element
• attribute
• text node
• processing instructions
• comments
To i
Markup Languages
Introduction to XML
Inforesources on XML
Resources on XML at Fl
XML document structure
Characters in XML documents
Prvky logické struktury (česky)
• uzel (element, atribut, textový uzel, instrukce pro zpracování, komentář)
• element
• atribut
• textový uzel
• instrukce pro zpracování
• komentář
Toi
Elements
Markup Languages Introduction to XML Inforesources on XML Resources on XML at Fl XML document structure Characters in XML documents
are objects delimited by start- and end-tag, generally:
text node — content of element p
Markup Languages Introduction to XML Inforesources on XML Resources on XML at Fl XML document structure Characters in XML documents Elements - empty If an element is empty (no child elements, neither text content inside), then we write just empty element tag, eg.: