100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Web Programming/Development Course Notes $20.49   Add to cart

Class notes

Web Programming/Development Course Notes

 2 views  0 purchase
  • Course
  • Institution

Are you looking to learn web development but don't know where to start? Do you struggle to keep track of all the different languages, frameworks, and tools that are used in web development? Look no further! Our web development notes have got you covered. Our comprehensive notes cover all the ess...

[Show more]

Preview 3 out of 19  pages

  • February 25, 2023
  • 19
  • 2022/2023
  • Class notes
  • Unknown
  • All classes
avatar-seller
Chapter 7. XML
Table of Contents

Objectives ................................................................................................................................................ 1
7.1 Introduction to Markup Languages ................................................................................................ 2
7.1.1 SGML ................................................................................................................................ 2
7.1.2 HTML ................................................................................................................................ 2
7.1.3 XML .................................................................................................................................. 2
7.1.4 Relationship ....................................................................................................................... 3
7.2 XML Primer ................................................................................................................................... 3
7.2.1 Validity and Well-Formedness .......................................................................................... 4
7.2.2 XML Declaration ............................................................................................................... 4
7.2.3 Encoding: Unicode ............................................................................................................ 4
7.2.4 Document Type Definition (DTD) .................................................................................... 5
7.2.5 Elements / Tags.................................................................................................................. 6
7.2.6 Entities ............................................................................................................................... 7
7.3 Creating your own ML based on XML .......................................................................................... 7
7.4 Parsing and Processing XML ......................................................................................................... 8
7.4.1 SAX ................................................................................................................................... 8
7.4.2 DOM .................................................................................................................................. 9
7.4.3 SAX vs DOM .................................................................................................................. 10
7.5 XML Namespaces ........................................................................................................................ 10
7.5.1 Default Namespaces ........................................................................................................ 11
7.5.2 Explicit Namespaces ........................................................................................................ 11
7.6 XML Schema ............................................................................................................................... 11
7.6.1 Schema Structure ............................................................................................................. 11
7.6.2 Sequences ........................................................................................................................ 11
7.6.3 Nested Elements .............................................................................................................. 12
7.6.4 Extensions ........................................................................................................................ 12
7.6.5 Attributes ......................................................................................................................... 12
7.6.6 Named Types ................................................................................................................... 12
7.6.7 Other Content Models ...................................................................................................... 13
7.6.8 Schema Namespaces ........................................................................................................ 13
7.6.9 Schema Example ............................................................................................................. 13
7.7 Data and Metadata ....................................................................................................................... 15
7.7.1 Metadata Standards .......................................................................................................... 15
7.7.2 Metadata Transformation ................................................................................................. 15
7.8 XPath ........................................................................................................................................... 16
7.8.1 XPath Syntax ................................................................................................................... 16
7.9 XSL .............................................................................................................................................. 17
7.10 XSLT........................................................................................................................................ 17
7.10.1 XSLT Templates ............................................................................................................ 17
7.10.2 XSLT Special Tags ........................................................................................................ 17
7.10.3 XSLT Language............................................................................................................. 17
7.10.4 XSLT Example .............................................................................................................. 18
7.11 Answers.................................................................................................................................... 19
7.11.1 Answer to Activity 1 ...................................................................................................... 19



Objectives
At the end of this chapter you will be able to:
• Explain different markup languages;
• Parse and process XML;
• Use the various XML attributes.

, XML




7.1 Introduction to Markup Languages
XML (eXtensible Markup Language) is a markup language for documents that contain structured information.
Markup refers to auxiliary information interspersed with text to indicate structure and semantics. Documents does not
only refer to traditional text-based documents, but also to a wide variety of other XML data formats, including
graphics, mathematical equations, financial transaction over a network, and many other classes of information.

Examples of markup languages include LaTex, which uses markup to specify formatting (e.g. \emph), and HTML which
uses markup to specify structure (e.g. <p>). A markup language specifies the syntax and semantics of the markup tags.

Here is a comparison between plain text and marked up text:

Plain text:

The quick brown
fox jumped over the lazy dog.

Marked up text:

*paragraphstart*The *subjectstart*quick brown fox
*subjectend* *verbstart*jumped*verbend* over the *objectstart*
lazy dog*objectend* .*paragraphend*

Marked up text aids in semantic understanding, since more information is associated with the sentence than just text itself.
This also makes it possible to automatically (i.e. by computer) translate to other formats.


7.1.1 SGML
SGML (Standard Generalised Markup Language) specifies a standard format for text markup. All SGML documents
follow a Document Type Definition (DTD that specifies the document's structure). Here is an example:

<!DOCTYPE uct PUBLIC "-//UCT//DTD SGML//EN">
<title>test SGML document
<author email='pat@cs.uct.ac.za' office=410 lecturer>Pat Pukram
<version>
<number>1.0
</version>

To do: SGML

Can you see why SGML does not require end tags? Find out more about SGML on the Internet. As a starting
point, look at the SGML resources page on the W3 Consortium website [http://www.w3.org/MarkUp/SGML/]. Also
search for SGML on Google [http:// www.google.com


7.1.2 HTML
HTML (HyperText Markup Language) specifies standard structures and formatting for linked documents on the World
Wide Web. HTML is a subset of SGML. In other words, SGML defines a general framework, while HTML defines
semantics for a specific application.

To Do: HTML
HTML is used to specify both the structure and the formatting of Web documents. Examine the list of HTML tags that
you have learnt so far and decide which group each tag belongs into. Read up more on the HTML section of the W3
page [http://www.w3.org/MarkUp/].


7.1.3 XML
2

, XML
XML, a subset of SGML, was introduced to ease adoption of structured documents on the Web. While SGML has been the
standard format for maintaining such documents, its suitability for the Web was poor (for various technical reasons,
some of which are discussed later; however, some are beyond the scope of this course). SGML conformity means that
XML documents can be read by any SGML system. However, the upside of XML is that XML documents do not
require a system capable of understanding the full SGML language.

Both HTML and SGML were considered unsuitable for the use that XML was put to. HTML specifies the semantics of a
document (which in HTML's case denotes formatting), but does not provide arbitrary structure. SGML however, does
provide arbitrary structure, but is too complex to implement in a Web browser. XML was not designed to replace SGML.
As a result, many companies use a SGML to XML filter for their content.

<uct>
<title>test XML document</title>
<author email="pat@cs.uct.ac.za" office="410" type="lecturer">Pat
Pukram</author>
<version>
<number>1.0</number>
</version>
</uct>


7.1.4 Relationship
The figure below illustrates the relationship between SGML, HTML, XML, and XHTML. XHTML is discussed later in
the chapter.




7.2 XML Primer
An XML document is a serialised segment of text which follows the XML standard (which can be found at the W3C
site [http://www.w3.org/TR/REC-xml]).

To Do: Goals of XML

XML's goals are set out in the W3C recommendations [http://www.w3.org/TR/REC-xml/#sec-origin-goals]. Read
these recommendations and, if some points are unclear, find out more about them.

An XML document may contain the following items:

• a XML declaration

• DTDs

• text


3

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller arshshops24. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $20.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

78998 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$20.49
  • (0)
  Add to cart