Second Task
1) "X" in XML stands for extensible (b). The "X" is significant because is means that XML can have user defined tags and is NOT predefined like HTML. It has a set of rules which define the meta-language but which allows it to evolve.
2) A markup language is a system of embedded codes to make an electronic document display on a web page as required (c). It defines the presentation and structure (and meaning) of the document in which it is. An example would be the html <h1> or <b> tags which define the size and boldness of the text following them.
3) SGML stands for Standard Generalized Markup Language (b). SGML prescribes a standard format for embedding descriptive markup within a document first used so that standards could be established for computers carrying out mark-up. SGML also specifies a standard method for describing the structure of a document. SGML proved unwieldy and too large so a subset of this, HTML was used for the mark-up commonly seen on the web today.
4) The relationship between SGML & XML can be said to be "XML is a slimmed-down, streamlined version of SGML" (d). XML is a simple subset of SGML designed for ease and interoperability with SGML and HTML. SGML is an ISO standard published in 1986 while XML was developed by the W3C in 1996.
Sunday, December 19, 2010
Friday, December 17, 2010
Week9
This week's lesson was on XLinks & XPointers which are a richer form of hyperlinks with more properties (attributes) and can be bidirectional. Ordinary tags can point to another document (or within the same document) by using the 'name' anchor in the destination as follows:
the source link; <A href="www.....com/page1.html # location1">click</A>
the destination link; <A name="location1">destination text</A>
The above are 'simple links' but XML allows also 'extended' links which provide much more functionality.
revised xml & css with these;
xml file:
<?xml version="1.0" ?>
<?xml-stylesheet href="t3.css" type="text/css"?>
<!--<!DOCTYPE legalDoc>-->
<legalDoc>
<title>my title</title>
<case>my case</case>
<background>my background</background>
<judjement>my judjement</judjement>
</legalDoc>
css file:
case {
color: #FF0000;
}
judjement {
color: #0000FF;
}
the source link; <A href="www.....com/page1.html # location1">click</A>
the destination link; <A name="location1">destination text</A>
The above are 'simple links' but XML allows also 'extended' links which provide much more functionality.
- outbound links have a local starting resource and a remote ending resource
- inbound links have a remote starting resource and a local ending resource
- third-party if starting and ending resource are both remote
- can be bi-directional
- may connect more than 2 documents
- the specification of the link may be in either of the 2 documents or in another one
- type: simple, extended, arc, locator
- href: URL
- label: identifier
- to: destination location
- from: source location
- show: replace, new, embed
- actuate: onRequest, onLoad
- role: points to a description URL
- title: a description
revised xml & css with these;
xml file:
<?xml version="1.0" ?>
<?xml-stylesheet href="t3.css" type="text/css"?>
<!--<!DOCTYPE legalDoc>-->
<legalDoc>
<title>my title</title>
<case>my case</case>
<background>my background</background>
<judjement>my judjement</judjement>
</legalDoc>
css file:
case {
color: #FF0000;
}
judjement {
color: #0000FF;
}
CMT3315 – Lab Session 09
Quick question:
- Suppose that a CSS file is used to determine how an XML document will appear when viewed in a browser. Suppose that the CSS file contains two rules, one dictating that a particular piece of text will appear in bold type, the other dictating that it will not. What will happen?
The latter rule (NOT bold) will be executed
- An XML document contains the sentence “The grand old Duke of York, he had 10000 men.” Would XPath be able to extract the piece of data “10000” from such a document?
Longer question:
Provide XPath expressions which will do the following:
a) Select all the elements subordinate to the root node.
//*
b) Select all track elements that have a total attribute with the value of 5.
//track/[@total="5"]
c) Select all elements that contain the word “Penderecki” in their title.
//CD[contains(title()=“Penderecki”)]
d) Select any elements that have titles with greater than 11 characters.
//CD[string-length(title())>5]
e) Select all the siblings of the first cd element.
//CD[1]/following-sibling::*
//CD[1]/following-sibling::*
Saturday, December 4, 2010
Week8
Today we discussed XPath which is used to model/describe (and query) xml documents. We also discussed Onthology (ES Expert Systems) and how it is shown in a triangel with KB (Knowledge Base), IR (Inference Rules), WM (Working Memory) and ;
> Concept (class)
> Slots (Roles & Properties)
> Facts (Property Restrictions-cardinality,domain,range..)
>Instances of classes
At home I revised XPath and its 7 node types;
root,
element,
attribute,
text,
namespace,
processing-instruction,
comment
> Concept (class)
> Slots (Roles & Properties)
> Facts (Property Restrictions-cardinality,domain,range..)
>Instances of classes
At home I revised XPath and its 7 node types;
root,
element,
attribute,
text,
namespace,
processing-instruction,
comment
CMT3315 – Lab Session 08
Quick questions:
1. You have a set of legal documents. Each has four sections: the title, the case, the background, and the judgement, in that order. Each has been made into an XML document by inserting a prolog and suitable tags. You want to write a CSS file that will display these documents using a suitable browser.
- Can you write the CSS file in such a way that it will display the title, then the judgement, then the background, then the case?
HTML file
<html>
<head>
<link rel="stylesheet" type="text/css" href="./t1.css" />
</head>
<body>
<p class="p1">
<atitle>my title</atitle>
</p>
<p class="p2">
<acase>my case</acase>
</p>
<p class="p3">
<abackground>my background</abackground>
</p>
<p class="p4">
<ajudjement>my judjement</ajudjement>
</p>
</body>
</html>
CSS file
.p1
{
position:absolute;
top:10px;
}
.p4
{
position:absolute;
top:40px;
}
.p3
{
position:absolute;
top:70px;
}
.p2
{
position:absolute;
top:100px;
}
- Can you write the CSS file in such a way that it will display just the title, and the judgement?
.p2
{
display:none;
}
.p3
{
display:none;
}
- If the CSS file is called legalWrit.css, what processing instruction should you put in the prolog of the XML document(s)?
<?xml-stylesheet href="legalWrit.css" type="text/css"?>
- What is the difference between a URI and a URL?
A URI represents a name or identifier possibly with namespace etc. which may or may not really point to a real resource, while a URL identifies an actual resource location or path.
- Why does the XML language allow namespaces?
To identify tags that have the same name within an XML file but which refer to a different item of data example an xml file with students and tutors the tag “ID” could reference both a student or a tutor so we can use student:ID and tutor:ID to distinguish between the two.
Longer questions:
1. Here is a short XML document. Type it out, as a new file in JCreator. Save it under the name memo1.xml in a suitable directory in your file system. Notice that the JCreator editor picks out the different components in different colours, to aid you in detecting errors.
<?xml version="1.0"?>
<?xml-stylesheet href="stylesheet01.css" type="text/css"?>
<!DOCTYPE memo>
<memo>
<id>Message: 1334</id>
<date>18 November 09</date>
<time>09:30</time>
<from>From: The Managing Director</from>
<to>To: Heads of all Departments</to>
<message>We must increase production. And increasing sales would be no bad thing either.</message>
</memo>
Now open another tab in JCreator and type the following style sheet out. Save it under the name stylesheet01.css in the same folder as memo1.xml. Notice that, this time, the editor does not pick out the different components in different colours.
memo {display: block; margin: 1em;}
id {display: block; margin: 1em; font-style: italic; font-size:200%}
date {display: block; margin: 1em;color: "dark blue"; text-align: left;}
time {display: block; margin: 1em;color: aqua; text-align: left;}
from, to {display: block; margin: 1em;color: green; text-align: left;}
message {display: block; margin: 1em;color: blue; text-align: left;}Now use the Mozilla Firefox browser to view the file memo1.xml.
XML
<?xml version="1.0"?>
<?xml-stylesheet href="tt2.css" type="text/css"?>
<!-- this breaks it on IE8 -->
<!--<!DOCTYPE memo>-->
<html>
<head>
</head>
<body>
<memo>
<id>Message: 1334</id>
<date>18 November 09</date>
<time>09:30</time>
<from>From: The Managing Director</from>
<to>To: Heads of all Departments</to>
<message>We must increase production. And increasing sales would be no bad thing either.</message>
</memo>
</body>
</html>
CSS
memo {display: block; margin: 1em;}
id {display: block; margin: 1em; font-style: italic; font-size:200%}
date {display: block; margin: 1em;color: "dark blue"; text-align: left;}
time {display: block; margin: 1em;color: aqua; text-align: left;}
from, to {display: block; margin: 1em;color: green; text-align: left;}
message {display: block; margin: 1em;color: blue; text-align: left;}
What was the point of putting “display: block” into the CSS file in each of the 6 lines?
To format the way that each data item is displayed.
Subscribe to:
Posts (Atom)