Home

Using an XML File

 

An XML File in a Browser

After creating an XML file, you can use it. One way you can do this is to display it in a grid-based window such as the DataGrid control. Another way you can display an XML file is in a browser. To do this, if you see the file in Windows Explorer, in My Computer, or in My Documents, you can double-click it.

Using a Style Sheet to Display an XML File in a Browser

When an XML file is displayed in a browser, it appears in a format that would be unclear to most people. If you want the XML code to display as if it were HTML, you can create a cascading style sheet that would format the tags and display the text as you prefer.

Here is an example of a CSS file:

CarYear
{
	display: block;
	font-weight: bold;
	font-size: 16pt;
	color: white;
	font-family: Garamond, Georgia, 'Times New Roman' , Serif;
	background-color: #990000;
}

Make
{
	font-size: 10pt;
	font-family: Verdana, Tahoma, Arial, Sans-Serif;
	background-color: white;
}

Model
{
	font-size: 10pt;
	font-family: Verdana, Tahoma, Arial, Sans-Serif;
	background-color: white;
}

PartNumber
{
	font-size: 10pt;
	color: #ff0066;
	font-family: Verdana, Tahoma, Arial, Sans-Serif;
	background-color: white;
	display: block;
}

PartName
{
	font-size: 10pt;
	color: #ff0066;
	font-family: Verdana, Tahoma, Arial, Sans-Serif;
	background-color: white;
	display: block;
}

UnitPrice
{
	font-size: 10pt;
	color: #ff0066;
	font-family: Verdana, Tahoma, Arial, Sans-Serif;
	background-color: white;
	display: block;
}

In the top section of the XML file, you would type:

<?xml:stylesheet href="cpap.css" type="text/css" ?>
 

Previous Copyright 2007, Yevol Next