Skip to content
Permalink
Browse files
Add files via upload
  • Loading branch information
danmolao committed Mar 22, 2020
1 parent 51bfef5 commit c28609210b48e29fb62712f16d693d420a03e45c
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 0 deletions.
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<buildings><building ID="1"><Name>Alma</Name><Address>Alma St, Coventry CV1 5QA</Address><History>This was built in the 1920s and is the home of our professional services such as Estates and Finance. This was the site of the Singer Works, out of which the Singer Penny Farthing was born and it also holds the origins to Coventry City Football Club.</History></building><building ID="2"><Name>Bugatti</Name><Address>Grove St, Coventry CV1 5PH</Address><History>This building funded by the Bugatti trust was built in 2002 and provides a valuable space for our Faculty of Arts and Humanities. In particular this is used in the areas of Automotive &amp; Transport Design with very strong industry links.</History></building><building ID="3"><Name>Charles Ward</Name><Address> Cope St, Coventry CV1 5FD</Address><History>Built in the 1950s this building is used mainly by our Faculty of Health and Life Sciences. The building was named after a key figure for the University, who was a University Governor, and became Vice Chair of the Board of Governors in 1982.</History></building><building ID="4"><Name>Engineering &amp; Computing Building</Name><Address>3 Gulson Rd, Coventry CV1 2JH</Address><History>This building was cleted in 2012 and is used solely by our Faculty of Engineering, Environment and Computing. The 50m project delivered a highly sustainable building that uses a range of technologies including rainwater harvesting, solar thermal energy and biomass boilers. Facilities include a high precision wind-tunnel, a 3m high-performance engineering centre, a Harrier Jump Jet, three flight simulators and the UKs largest magnet.</History></building><building ID="5"><Name>Ellen Terry</Name><Address> 34-35 Jordan Well, Coventry CV1 5RW</Address><History>This is used by our Faculty of Arts and Humanities, specifically for the performing arts, media and music. Built in 1880, the building underwent a major refurbishment in 2000. Fittingly, it was previously a cinema, and is named after Dame Ellen Terry, a star of the Victorian stage and a leading Shakespearean actress.</History></building><building ID="6"><Name>George Eliot</Name><Address>Priory St, Coventry CV1 5FB</Address><History>This building was built in 1960 and is used solely by our Faculty of Business and Law. George Eliot is the pen name of the novelist Mary Anne Evans (1819-1880) and was one of the leading writers of the Victorian era.</History></building><building ID="7"><Name>Graham Sutherland</Name><Address>Cox St, Coventry CV1 5PH</Address><History>Built in 1959, this building is currently undergoing an extensive internal redevelopment. Once completed, it will continue to be used by the Faculty of Arts and Humanities, predominantly by design and visual art students. It is aptly named after the painter and printmaker Graham Sutherland, who created the world-famous tapestry Christ in Glory in Coventry Cathedral.</History></building><building ID="8"><Name>TheHub</Name><Address>Priory St, Coventry CV1 5FB</Address><History>Completed in 2011 TheHubis a modern, hi-tech building providing a welcoming social space for our students. Facilities in the building include a doctors surgery, a multi-cultural faith centre, employment services, catering services, as well as hairdressers, food court and the Students Union offices. This building also has a large fully licensed function space with bars and a multi-purpose venue space. The building achieved a BREEAM status of Excellent.</History></building><building ID="9"><Name>Jaguar</Name><Address>113A Gosford St, Coventry CV1 5DL</Address><History>This building was built in the late 1970s and sponsored by the Coventry based car manufacturer. It has recently undergone a significant refurbishment, with additional improvements planned. It is now home to our Postgraduate students, as well as our researchers within the Centre for Business in Society (CBiS).</History></building><building ID="10"><Name>John Laing</Name><Address>Much Park St, Coventry CV1 2LT</Address><History>This building is primarily used by the Faculty of Engineering, Environment and Computing, offering courses relating to the construction sector. It was built in 1970, and is named after Sir John Laing, a British entrepreneur in the construction industry.</History></building><building ID="11"><Name>Lanchester Library</Name><Address>Gosford St, Coventry CV1 5DD</Address><History>This striking building houses the main university library. It was opened in 2001, and in 2019 was upgraded to bring together all elements of academic support into one location, with a new entrance, cafe and collaboration spaces on the ground floor. It is named after Frederick Lanchester, the Coventry-based designer of the first British petrol-driven car. It is equipped with more than 350 computers, group and individual study rooms, books, journals, and electronic resources across five floors.</History></building><building ID="12"><Name>Maurice Foss</Name><Address>Cox St, Coventry CV1 5PH</Address><History>Built in 1978, this building is currently undergoing an extensive internal redevelopment. Once completed, it will continue to be used by the Faculty of Arts and Humanities, primarily for industrial design courses. The building is named after Maurice Foss, the former Deputy Director of Coventry Polytechnic and one of the universitys Honorary Life Fellows.</History></building><building ID="13"><Name>Mile Lane</Name><Address>8 Mile Ln, Coventry CV1 2TU</Address><History>This is the new state-of-the-art campus for CU Coventry, which offers an innovative education model designed to integrate study into your life. The building is a cutting-edge learning environment designed to enable collaboration, creativity and innovation to flourish, with on-site parking, energy-efficient features and high quality catering facilities.</History></building><building ID="14"><Name>Multi-Storey Car Park</Name><Address>Gosford St, Coventry CV1 5DL</Address><History>This is our impressive multi-storey car park, opened for staff and visitors in 2010. It has 457 spaces over 15 floors, including spaces for electric vehicles.</History></building><building ID="15"><Name>Priory Building</Name><Address>Priory Building, Coventry CV1 5FJ</Address><History>Built in 1964, this is occupied by the Cambridge Education Group, which runs its Coventry foundation campus from here, offering university pathway courses for overseas students who wish to gain entry to UK universities. The building also houses a large sports hall.</History></building><building ID="16"><Name>Richard Crossman</Name><Address>Jordan Well, Road, Coventry CV1 5RW</Address><History>This was built in 1971 and is named after the political journalist and Labour politician Richard Crossman, who represented Coventry East from 1945 to 1974. It is used by the Faculty of Health and Life Sciences, primarily for psychology, criminology and social sciences subjects, and includes mock prison cells and psychology labs.</History></building><building ID="17"><Name>Student Centre</Name><Address>1 Gulson Rd, Coventry CV1 2JH</Address><History>Opened in 2006, the centre is home to many of our key student services as well as our International Office. This is where our students enrol and is also a main information point for student accommodation and finance queries.</History></building><building ID="18"><Name>Whaitfriars</Name><Address>62 Whitefriars St, Coventry CV1 2DS</Address><History>This is a small office used by our Faculty of Health and Life Sciences. Built in 1922, its name is drawn from the Carmelite Friary founded in 1342 in Coventry.</History></building><building ID="19"><Name>William Lyons</Name><Address>Gosford St, Coventry CV1 5DL</Address><History>Constructed in 1980, this building is used by a number of our professional services teams. It is named after Sir William Lyons, the co-founder of the Swallow Sidecar Company, which subsequently became Jaguar Cars Limited.</History></building><building ID="20"><Name>William Morris</Name><Address>Gosford St, Coventry CV1 5DL</Address><History>This building began life in 1910 as a factory and is named after the founder of the Morris car company, which used this building as part of its engine production unit. It was converted for use by the university and is now occupied by our Faculty of Business and Law.</History></building></buildings>
112 index.php
@@ -0,0 +1,112 @@
<?php


$dbServername = "68.183.39.178";
$dbUsername="test5";
$dbPassword="test6";
$dbName="DB";
// Database information

$conn =mysqli_connect($dbServername,$dbUsername,$dbPassword,$dbName);
//Storing the connection to the databse in a variable conn




if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}

$query = " SELECT ID ,Name, Address, History FROM Buildings";
// sql query to select desired information from database

$buildingsArray= array();

//create an array

if ($result =$conn->query($query)){
//run query to get result set of data from database

while ($row = $result->fetch_assoc()){
//loop through result set and fetch rows

array_push($buildingsArray,$row);

// rows are now pushed on to a array

}

if(count($buildingsArray)){
build_document($buildingsArray);

// if their are elements in the array then build xml documnet

}

$result->free();



}

$conn->close();

//close the connection to themysql database

function build_document($buildingsArray){

$filePath = 'building.xml';
// create xml
$dom = new DOMDocument('1.0', 'utf-8');
$root = $dom->createElement('buildings');
// root of document called buildings
for($count=0; $count<count($buildingsArray); $count++){
// loop through until result set of buildings

$buildingID = ($buildingsArray[$count]['ID']);
$buildingName = htmlspecialchars($buildingsArray[$count]['Name']);
$buildingAddress = ($buildingsArray[$count]['Address']);
$buildingHistory = htmlspecialchars($buildingsArray[$count]['History']);

// assign the results to my own variables

$building = $dom->createElement('building');
$building->setAttribute('ID', $buildingID);
// create header building in xml file
// add building id to xml file

$name = $dom->createElement('Name', $buildingName);
$building->appendChild($name);
// create header Name in xml file
// add building name to xml file
$address = $dom->createElement('Address', $buildingAddress);
$building->appendChild($address);
//create header Address in xml file
//add address to xml file
$history = $dom->createElement('History', $buildingHistory);
$building->appendChild($history);
// create header History in xml document
// add history to xml to file



$root->appendChild($building);
// add header to the bittom callled buildings
}

$dom->appendChild($root);
$dom->save($filePath);
}











?>

0 comments on commit c286092

Please sign in to comment.