帮派!
我认为这可能有用。 代码是College的一个相当老的项目,代码很熟悉,但是以防万一有人在找。
程序:公寓搜索数据库语言: HTML,XML,XSL,CSS,JavaScript(1)将以下内容保存在一个名为
apartmentlist.xml此文件与“公寓搜索数据库”中的网页链接。 确保将文件另存为.xml ,另存为类型:所有文件。
<?xml version="1.0"?>
<!-- File Name: apartmentlist.xml -->
<?xml-stylesheet type="text/xsl" href="ApartmentSearch.xsl"?>
<RENTALUNITS>
<LISTING>
<APARTMENT>Konner Ridge</APARTMENT>
<ADDRESS>23 Monroe St.</ADDRESS>
<PHONE>256-5533</PHONE>
<BEDROOMS>3</BEDROOMS>
<BATHS>2</BATHS>
<VACANCY>2</VACANCY>
</LISTING>
<LISTING>
<APARTMENT>Konner Ridge</APARTMENT>
<ADDRESS>23 Monroe St.</ADDRESS>
<PHONE>256-5533</PHONE>
<BEDROOMS>1</BEDROOMS>
<BATHS>1</BATHS>
<VACANCY>2</VACANCY>
</LISTING>
<LISTING>
<APARTMENT>River Side Apartments</APARTMENT>
<ADDRESS>400 St. Joe River Rd.</ADDRESS>
<PHONE>395-4474</PHONE>
<BEDROOMS>1</BEDROOMS>
<BATHS>1</BATHS>
<VACANCY>2</VACANCY>
</LISTING>
<LISTING>
<APARTMENT>White Oak Apartments</APARTMENT>
<ADDRESS>900 W. 111th St</ADDRESS>
<PHONE>398-4123</PHONE>
<BEDROOMS>2</BEDROOMS>
<BATHS>2</BATHS>
<VACANCY>1</VACANCY>
</LISTING>
<LISTING>
<APARTMENT>Moore Woods Apartments</APARTMENT>
<ADDRESS>200 N. 1st St.</ADDRESS>
<PHONE>695-0695</PHONE>
<BEDROOMS>2</BEDROOMS>
<BATHS>1</BATHS>
<VACANCY>2</VACANCY>
</LISTING>
<LISTING>
<APARTMENT>Rhodes Manner Apartments</APARTMENT>
<ADDRESS>1000 Welsh Ave</ADDRESS>
<PHONE>395-3305</PHONE>
<BEDROOMS>4</BEDROOMS>
<BATHS>2</BATHS>
<VACANCY>2</VACANCY>
</LISTING>
</RENTALUNITS>
(2)将其另存为另一个XML文件,命名为App_Price.xml
将其粘贴到名为
贝兹 该文件与公寓搜索数据库中的网页链接。 确保将文件另存为.xml ,另存为类型:所有文件。
<?xml version="1.0"?>
<!-- File Name: App_Price.xml -->
<Find_It>
<Apartmnt>
<Name>Konner Ridge</Name>
<Type>Condominium</Type>
<Crime-Rate_1>13 % Low</Crime-Rate_1>
<Crime-Rate_2>26 % High</Crime-Rate_2>
<Your_Price>$189,000.00</Your_Price>
</Apartmnt>
<Apartmnt>
<Name>Konner Ridge III</Name>
<Type>Apartment Building</Type>
<Crime-Rate_1>23 % Low</Crime-Rate_1>
<Crime-Rate_2>35 % High</Crime-Rate_2>
<Your_Price>$89,000.00</Your_Price>
</Apartmnt>
<Apartmnt>
<Name>Konner Ridge VI</Name>
<Type>1600 Brick House</Type>
<Crime-Rate_1>10 % Low</Crime-Rate_1>
<Crime-Rate_2>12 % High</Crime-Rate_2>
<Your_Price>$1,600,000.00</Your_Price>
</Apartmnt>
<Apartmnt>
<Name>Eastwood Place Apartments</Name>
<Type>Brick Mansion</Type>
<Crime-Rate_1>9 % Low</Crime-Rate_1>
<Crime-Rate_2>12 % High</Crime-Rate_2>
<Your_Price>$590,000.00</Your_Price>
</Apartmnt>
<Apartmnt>
<Name>Blair House</Name>
<Type>Condominium</Type>
<Crime-Rate_1>5 % Low</Crime-Rate_1>
<Crime-Rate_2>10 % High</Crime-Rate_2>
<Your_Price>$2,021,899.00</Your_Price>
</Apartmnt>
<Apartmnt>
<Name>Blair House IV</Name>
<Type>Old Brick House</Type>
<Crime-Rate_1>3 % Low</Crime-Rate_1>
<Crime-Rate_2>8 % High</Crime-Rate_2>
<Your_Price>$678,000.00</Your_Price>
</Apartmnt>
<Apartmnt>
<Name>Vorhaus Condos</Name>
<Type>Condominium</Type>
<Crime-Rate_1>11 % Low</Crime-Rate_1>
<Crime-Rate_2>16 % High</Crime-Rate_2>
<Your_Price>$1,189,000.00</Your_Price>
</Apartmnt>
<Apartmnt>
<Name>The French Quarter</Name>
<Type>Condominium</Type>
<Crime-Rate_1>3 % Low</Crime-Rate_1>
<Crime-Rate_2>6 % High</Crime-Rate_2>
<Your_Price>$699,670.00</Your_Price>
</Apartmnt>
</Find_It>
(3)添加XSL文件,必须将其命名为ApartmentSearch.xsl。此文件与Apartment Search数据库中的网页链接。
确保另存为.xsl ,另存为类型:所有文件。
<?xml version="1.0"?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
Database search
<center>
<a href="Uhome.html"><img border="0" src="4433444.bmp" alt="Click here to go home"></img></a>
<h2>Browse Availability</h2>
</center>
<xsl:for-each select="RENTALUNITS/LISTING">
<xsl:sort select="APARTMENT" />
<p>
<span style="font-style:italic; font-weight: 900; color: #ff6633">
<xsl:value-of select="ADDRESS" />
</span>
<xsl:text> </xsl:text>
<span style="font-variant:small-caps; font-weight:bold">
<xsl:value-of select="PHONE"/>
</span>
</p>
<p style="margin-left: 3%">
<span style="font-weight:bold">Number of Bedrooms/Baths </span>
<xsl:value-of select="BEDROOMS" /> bedrooms and <xsl:value-of select="BATHS"/> baths.
Number of vacancies:
<span style="font-style:italic; font-weight: bold; color:#009999">
<xsl:value-of select="VACANCY" />
</span>
</p>
</xsl:for-each>
</xsl:template>
</xsl:transform>
(4)添加几个HTML文件,该文件应命名为apartment.html。此文件与Apartment Search数据库中的网页链接。
请确保另存为.html ,另存为类型:所有文件。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Fetch Bedrooms</title>
</head>
<body bgcolor="gray">
<xml id="dsoRENTALUNITS" src="BEDS/App_Price.xml"></xml>
<p align="center">
<a href="index.htm"><img border="0" src="img_citywide.gif"></img></a></p>
<p></p>
<p style="font-size:24px; color: #332266; font-weight:900">Search By # of Rooms</p>
<p style="font-size:18px; color: white; font-weight:100">Number of Rooms:<input type="text" id="searchtext" size="20" onKeyPress="keyPressed()">
<button onClick="findApp()">search</button>
</p>
<hr size="5" color="#cccccc"/>
<div id="searchresult">
<p style="font-size:18px; color: lime; font-weight:100">Results:
</div>
<script type="text/javascript">
<!--hide from old browsers
function keyPressed(k) {
var hitEnter=event.keyCode
if (hitEnter==13) findApp()
}
function findApp() {
searchstring = searchtext.value.toUpperCase()
if (searchstring=="") {
searchresult.innerHTML = "<b>Please add # of rooms in textbox.</b>"
return
}
dsoRENTALUNITS.recordset.moveFirst()
var outputresult=""
while (!dsoRENTALUNITS.recordset.EOF) {
namestring = dsoRENTALUNITS.recordset("Num_Bed").value
if (namestring.toUpperCase().indexOf(searchstring)>=0)
outputresult += "<b>" + dsoRENTALUNITS.recordset("Num_Bed")+"</b> ("+dsoRENTALUNITS.recordset("Beds")+")</p>"
+ "<p style='margin-left:25px'><b>Location: </b>"+dsoRENTALUNITS.recordset("Local")+"</p>"
+ "<p style='margin-left:25px'><b>For: </b>"
+ dsoRENTALUNITS.recordset("Option_Bound") +"<br /></p>"
dsoRENTALUNITS.recordset.moveNext()
}
if (outputresult=="")
searchresult.innerHTML = "Number of rooms selected currently unavailable."
else
searchresult.innerHTML = outputresult
}
//-->
</script>
<hr size="5" color="#cccccc" />
<br>
<table align="center" width="670">
<tr>
<td width="34%">
<a href="apartmentlist.xml">Browse Location</a>
</td>
<td width="34%">
<a href="apartment_price.html">Browse Price</a>
</td>
<td width="32%">
<a href="apartment.html">Search Rooms</a>
</td>
</tr>
</table>
</center>
<br>
<br>
<p>
<b><CENTER>
<FONT FACE="Arial" SIZE="-2" color="white">
Copyright © 2006-2008 For more information about our business,<br> please contact us: <a href="mailto:XXXXXXX@Me.org"><FONT FACE="Arial" SIZE="-2" color="lightgreen"><b>XXXXXXX@Me.org</a></b></font><br> All rights reserved.
<br></CENTER>
</p>
</FONT></b>
</body>
</html>
(5)下列名称,
apartment_price.html此文件与“公寓搜索数据库”中的网页链接。 请确保另存为.html ,另存为类型:所有文件。
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<xml id="dsoApp" src="App_Price.xml"></xml>
<head>
<title>Browse By Price</title>
</head>
<body bgcolor="gray">
<center>
<a href="index.html"><img border="0" src="img_citywide.gif"></img></a>
<h2>Apartment Listing By Price</h2>
<button onclick="AppTable.firstPage()">|< First Page </button>
<button onclick="AppTable.previousPage()">< Previous Page </button>
<button onclick="AppTable.nextPage()"> Next Page > </button>
<button onclick="AppTable.lastPage()"> Last Page >| </button>
<hr color="#666666" size="5" width="75%" />
<table id="AppTable" datasrc="#dsoApp" datapagesize="6" border="1" cellpadding="5">
<thead style="color:darkred; font-size:14pt; font-weight:900">
<th>TYPE</th>
<th>NAME</th>
<th>CRIME RATE</th>
<th>YOUR PRICE</th>
</thead>
<tr>
<td><span datafld="Type" style="font-family:arial; font-style:italic"></span></td>
<td><span datafld="Name" style="font-family:arial; font-weight:900"></span></td>
<td><span datafld="Crime-Rate_1"></span>, <span datafld="Crime-Rate_2"></span></td>
<td><span datafld="Your_Price"></span></td>
</tr>
</table>
<br>
<table align="center" width="670">
<tr>
<td width="34%">
<a href="apartmentlist.xml">Browse Location</a>
</td>
<td width="34%">
<a href="apartment_price.html">Browse Price</a>
</td>
<td width="32%">
<a href="apartment.html">Search Bedrooms</a>
</td>
</tr>
</table>
</center>
<p>
<b><CENTER>
<FONT FACE="Arial" SIZE="-2" color="white">
Copyright © 2006-2008 For more information about our business,<br> please contact us: <a href="mailto:XXXXXXX@You.org"><FONT FACE="Arial" SIZE="-2" color="lightgreen"><b>XXXXXXX@You.org</a></b></font><br> All rights reserved.
<br></CENTER>
</p>
</FONT></b>
</body>
</html>
(6)这是我们的
index.html该文件与公寓搜索数据库中的网页链接。 请确保另存为.html ,另存为类型:所有文件。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XXXXX, Inc. Apartment Search</title>
</head>
<body bgcolor="gray">
<table border="0" width="90%">
<tr>
<td><div align="center"><p style="font-weight:bold"><center>Welcome our home Page! <br><img src="7666646.gif" /></div>
</tr></td>
</table>
<table border="0" width="90%">
<tr>
<td align="center" width="26%"><img src="ttttetetetet.jpg" usemap="#DatabaseSearchbar"/>
<map name="DatabaseSearchbar">
<area shape="rect" coords="16,90,195,117" href="apartmentlist.xml" alt="Browse Location" />
<area shape="rect" coords="39,131,167,157" href="apartment_price.html" alt="Browse Price" />
<area shape="rect" coords="35,169,173,195" href="apartment.html" alt="Search Bedrooms" />
</map>
</td>
</tr>
</table>
<br>
<table align="center" width="670">
<tr>
<td width="34%">
<a href="apartmentlist.xml">Browse Location</a>
</td>
<td width="34%">
<a href="apartment_price.html">Browse Price</a>
</td>
<td width="32%">
<a href="apartment.html">Search Bedrooms</a>
</td>
</tr>
</table>
<p>
<b><CENTER>
<FONT FACE="Arial" SIZE="-2" color="white">
Copyright © 2006-2008 For more information about our business,<br> please contact us: <a href="mailto:XXXXXXX@You.org"><FONT FACE="Arial" SIZE="-2" color="lightgreen"><b>XXXXXXX@You.org</a></b></font><br> All rights reserved.
<br></CENTER>
</p>
</FONT></b>
</body>
</html>
请注意:本网站中的XML数据通过多种平台进行管理。
一个ASP.NET网站允许将数据添加到SQL Server 2005数据库,然后将其加载到Access数据库。
一个VB应用程序帮助组成XML文件以加载到上面。
相关链接: http : //bytes.com/forum/thread762010.html 添加的信息: http : //bytes.com/forum/thread777267.html
玩得开心!
德克尔
From: https://bytes.com/topic/xml/insights/672308-xml-start-finish-phase-1-a