When you view an XML document in a web-browser you see the XML tree structure.
But it is possible for you to format the display using CSS, but mostly you would be using XSLT to transform the document with.
Here is a small example of how you can use CSS formatting for an XML document.
CSS file
books {
background-color: #000000;
width: 40%;
}
book {
background-color: #FF0000;
display : block;
margin-bottom: 20px;
}
title, price {
display : block;
color: blue;
}
XML document
<?xml version="1.0" encoding="ISO8859-1" ?>
<?xml-stylesheet type="text/css" href="books.css">
<books>
<book>
<title>Lord of the rings</title>
<price>1.99</price>
</book>
<book>
<title>The davinci mystery</title>
<price>2.99</price>
</book>
</books>
Showing posts with label xml. Show all posts
Showing posts with label xml. Show all posts
Tuesday, October 31, 2006
Friday, October 27, 2006
DTD
The purpose of a DTD is to describe the building blocks of an XML document, you can declare a DTD inline in your XML document or you can create an external file and reference to that from your XML document.
The DTD should be located just after the XML declaration, if you use an external DTD the reference is likewise after the XML declaration.
Example of an external DTD reference
<!DOCTYPE book SYSTEM "book.dtd">
Example of an internal DTD
<!DOCTYPE book [
<!ELEMENT book (title, author)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
]>
<book>
<title>James goes to hollywood</title>
<author>Sam Jones</author>
</book>
The DTD should be located just after the XML declaration, if you use an external DTD the reference is likewise after the XML declaration.
Example of an external DTD reference
<!DOCTYPE book SYSTEM "book.dtd">
Example of an internal DTD
<!DOCTYPE book [
<!ELEMENT book (title, author)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
]>
<book>
<title>James goes to hollywood</title>
<author>Sam Jones</author>
</book>
Tuesday, October 17, 2006
First post
This is my first post in my blog about XML.
In the following months, I will post my experiences with XML to this blog and share my growing knowledge about this subject. I am just a novice and I expect to only make slow progress, so you will not have any problem following my pace.
In the following months, I will post my experiences with XML to this blog and share my growing knowledge about this subject. I am just a novice and I expect to only make slow progress, so you will not have any problem following my pace.
Subscribe to:
Posts (Atom)