XML Interviews Question page5,xml Interviews Guide,xml Interviews Posted on: April 18, 2011 at 12:00 AM
This page discusses - XML Interviews Question page5,xml Interviews Guide,xml Interviews
XML Interviews Question page5
Do I have to know HTML or SGML before I learn XML?
No, although it's useful because a lot of XML terminology and practice derives from two decades' experience of SGML.
Be aware that ‘knowing HTML’ is not the same as ‘understanding SGML’. Although HTML was written as an SGML application, browsers ignore most of it (which is why so many useful things don't work), so just because something is done a certain way in HTML browsers does not mean it's correct, least of all in XML.
What does an XML document actually look like (inside)?
The basic structure of XML is similar to other applications of SGML, including HTML. The basic components can be seen in the following examples. An XML document starts with a Prolog:
1. The XML Declaration which specifies that this is an XML document;
2. Optionally a Document Type Declaration
which identifies the type of document and says where the Document Type Description (DTD) is stored;
The Prolog is followed by the document inst
1. A root element, which is the outermost (top level) element (start-tag plus end-tag) which encloses everything else: in the examples below the root elements are conversation and titlepage;
2. A structured mix of descriptive or prescriptive elements enclosing the character data content (text), and optionally any attributes (‘name=value’ pairs) inside some start-tags.
XML documents can be very simple, with straightforward nested markup of your own design:
<?xml version="1.0" standalone="yes"?>
<response>Stop the planet, I want to get
Or they can be more complicated, with a Schema or question C.11, Document Type Description (DTD) or internal subset (local DTD changes in [square brackets]), and an arbitrarily complex nested structure:
<?xml version="1.0" encoding="iso-8859-1"?>
[<!ENTITY % active.links "INCLUDE">]>
<white-space type="vertical" amount="36"/>
<title font="Baskerville" alignment="centered"
<white-space type="vertical" amount="12"/>
<!-- In some copies the following
decoration is hand-colored, presumably
by the author -->
<white-space type="vertical" amount="24"/>
<author font="Baskerville" size="18/22"
<white-space type="vertical" role="filler"/>
Or they can be anywhere between: a lot will depend on how you want to define your document type (or whose you use) and what it will be used for. Database-generated or program-generated XML documents used in e-commerce is usually unformatted (not for human reading) and may use very long names or values, with multiple redundancy and sometimes no character data content at all, just values in attributes: