本文整理汇总了PHP中parseToXML函数的典型用法代码示例。如果您正苦于以下问题:PHP parseToXML函数的具体用法?PHP parseToXML怎么用?PHP parseToXML使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parseToXML函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: format
/**
* Format the nodeset output to an <ul> list
* This is just for the scriptaculous autocompleter field
*
* @param Object $object - the data to format
* @return string
*/
function format($object)
{
global $CFG;
if (!$object instanceof NodeSet) {
$doc = "<?xml version=\"1.0\"?>";
$doc .= "<error><message>" . $object->message . "</message><code>" . $object->code . "</code></error>";
return $doc;
}
$doc = "<?xml version=\"1.0\"?>";
$doc .= "<data>";
$nodes = $object->nodes;
foreach ($nodes as $node) {
// can only display if the node has at least a start date
if (isset($node->startdatetime)) {
$doc .= "<event start='" . date(r, $node->startdatetime) . "'";
if ($node->enddatetime) {
$doc .= " end='" . date(r, $node->enddatetime) . "'";
// work out if it's a duration or not
if ($node->startdatetime != $node->enddatetime) {
$doc .= " isDuration='true'";
}
}
$doc .= " title='" . parseToXML($node->name) . "'";
//add url
$doc .= " link='" . $CFG->homeAddress . "node.php?nodeid=" . $node->nodeid . "'";
$doc .= ">";
$doc .= parseToXML(strip_tags($node->description));
$doc .= "</event>";
}
}
$doc .= "</data>";
return $doc;
}
示例2: XML
function XML()
{
// Select all the rows in the markers table
$query = "SELECT * FROM aiesec_trainees WHERE 1";
$result = mysql_query($query);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
header("Content-type: text/xml");
// Start XML file, echo parent node
echo '<markers>';
// Iterate through the rows, printing XML nodes for each
while ($row = @mysql_fetch_assoc($result)) {
// ADD TO XML DOCUMENT NODE
echo '<marker ';
echo 'id="' . parseToXML($row['id']) . '" ';
echo 'name="' . parseToXML($row['name']) . '" ';
echo 'address="' . parseToXML($row['address']) . '" ';
echo 'lat="' . $row['lat'] . '" ';
echo 'lng="' . $row['lng'] . '" ';
echo 'type="' . $row['type'] . '" ';
echo '/>';
}
// End XML file
echo '</markers>';
}
示例3: generateMarkers
function generateMarkers($con, $marker_id, $showPathMarkers, $markerDelay)
{
// Select all the rows in the markers table
$markerSql = "";
if ($marker_id != "") {
$markerSql = "ge.gps_entry_id = " . phpGPS_DB::cleanInput($marker_id);
}
//build query, if marker is set, then show regardless of status
$query = "SELECT \n" . " * \n" . "FROM \n" . " gps_entries ge \n" . " left join gps_type gt on ge.gps_type_id = gt.gps_type_id \n";
$query = $query . "WHERE \n";
if ($markerSql == "") {
$query = $query . " ((ge.gps_status <> 'H' ";
if (!$showPathMarkers) {
$query = $query . "AND ge.gps_status <> 'P' ";
}
$query = $query . ") or ge.gps_status IS NULL) \n";
//H is Hidden, P is Path Only
} else {
$query = $query . " {$markerSql} \n";
}
if ($markerDelay != null && $markerDelay > 0) {
$query = $query . " AND ge.gps_entry_date < NOW() - INTERVAL {$markerDelay} DAY \n";
}
$query = $query . "ORDER BY \n" . " ge.gps_date;";
$result = mysqli_query($con, $query);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
//Exit if no results
if ($result->num_rows == 0) {
return;
}
//Start Marker XML
echo '<markers>';
// Iterate through the rows, printing XML nodes for each
while ($row = @mysqli_fetch_assoc($result)) {
echo '<marker ';
echo 'id="' . parseToXML($row['gps_entry_id']) . '" ';
echo 'name="' . parseToXML($row['gps_name']) . '" ';
echo 'comment="' . parseToXML($row['gps_comment']) . '" ';
echo 'address="' . parseToXML($row['gps_address1']) . '" ';
echo 'lat="' . $row['gps_latitude'] . '" ';
echo 'lng="' . $row['gps_longitude'] . '" ';
echo 'accuracy="' . $row['gps_accuracy'] . '" ';
echo 'path_id="' . $row['gps_path_id'] . '" ';
echo 'type_name="' . $row['gps_type_name'] . '" ';
echo 'image="' . $row['gps_type_image'] . '" ';
echo 'custom_icon_name="' . $row['gps_type_icon'] . '" ';
echo '/>';
}
// End XML file
echo '</markers>';
}
示例4: format
/**
* Format the nodeset output to an <ul> list
* This is just for the scriptaculous autocompleter field
*
* @param Object $object - the data to format
* @return string
*/
function format($object)
{
global $CFG;
$doc = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
$doc .= "<rss version=\"2.0\"\n xmlns:content=\"http://purl.org/rss/1.0/modules/content/\"\n xmlns:dc=\"http://purl.org/dc/elements/1.1/\">";
$doc .= "<channel>";
$doc .= "<title>" . $CFG->SITE_TITLE . "</title>";
$doc .= "<link>" . $CFG->homeAddress . "</link>";
$doc .= "<description></description>";
$doc .= "<pubDate>" . date('r') . "</pubDate>";
$doc .= "<language>en</language>";
if ($object instanceof NodeSet) {
$nodes = $object->nodes;
foreach ($nodes as $node) {
$role = $node->role;
$url = $CFG->homeAddress . "explore.php?nodeid=" . $node->nodeid;
$doc .= "<item>";
$doc .= "<title>" . parseToXML($node->name) . "</title>";
$doc .= "<link>" . $url . "</link>";
$doc .= "<pubDate>" . date('r', $node->creationdate) . "</pubDate>";
$user = $node->users[0];
$doc .= "<dc:creator>" . $user->name . "</dc:creator>";
$doc .= "<description><![CDATA[" . $node->description . "]]></description>";
$doc .= "<content:encoded><![CDATA[" . $node->description . "]]></content:encoded>";
$doc .= "<guid isPermaLink='true'>" . $url . "</guid>";
$doc .= "</item>";
}
} else {
if ($object instanceof ConnectionSet) {
$conns = $object->connections;
foreach ($conns as $conn) {
$doc .= "<item>";
$doc .= "<title>" . parseToXML($conn->from->name) . " -> " . parseToXML($conn->to->name) . "</title>";
$doc .= "<link>" . $CFG->homeAddress . "node.php?nodeid=" . $conn->from->nodeid . "#conn-neighbour</link>";
$doc .= "<pubDate>" . date('r', $conn->creationdate) . "</pubDate>";
$user = $conn->from->users[0];
$doc .= "<dc:creator>" . $user->name . "</dc:creator>";
$fNode = $conn->from;
$tNode = $conn->to;
$desc = "<a href='" . $CFG->homeAddress . "node.php?nodeid=" . $conn->from->nodeid . "#conn-neighbour'>" . $fNode->name . "</a>";
$desc .= " -[" . $conn->linktype->label . "]-> ";
$desc .= "<a href='" . $CFG->homeAddress . "node.php?nodeid=" . $conn->to->nodeid . "#conn-neighbour'>" . $tNode->name . "</a>";
$doc .= "<description><![CDATA[" . $desc . "]]></description>";
$doc .= "<content:encoded><![CDATA[" . $desc . "]]></content:encoded>";
$doc .= "<guid isPermaLink='true'>" . $CFG->homeAddress . "node.php?nodeid=" . $conn->from->nodeid . "#conn-neighbour</guid>";
$doc .= "</item>";
}
}
}
$doc .= "</channel></rss>";
return $doc;
}
示例5: mysqli
// Create the database connection
$mysqli = new mysqli(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
if ($mysqli->connect_errno) {
echo 'Connection error: (', $mysqli->connect_errno, ') ', $mysqli->connect_error;
}
$results = $mysqli->query("SELECT * FROM businesses");
function parseToXML($htmlStr)
{
$xmlStr = str_replace('<', '<', $htmlStr);
$xmlStr = str_replace('>', '>', $xmlStr);
$xmlStr = str_replace('"', '"', $xmlStr);
$xmlStr = str_replace("'", ''', $xmlStr);
$xmlStr = str_replace("&", '&', $xmlStr);
return $xmlStr;
}
header("Content-type: text/xml");
echo '<markers>';
while ($row = $results->fetch_assoc()) {
echo '<marker ';
echo 'name="' . parseToXML($row['name']) . '" ';
echo 'type="' . parseToXML($row['type']) . '" ';
echo 'latitude="' . parseToXML($row['latitude']) . '" ';
echo 'longitude="' . parseToXML($row['longitude']) . '" ';
echo 'address="' . parseToXML($row['address']) . '" ';
echo 'city="' . parseToXML($row['city']) . '" ';
echo 'state="' . parseToXML($row['state']) . '" ';
echo 'phone="' . parseToXML($row['phone']) . '" ';
echo 'website="' . parseToXML($row['website']) . '" ';
echo '/>';
}
echo '</markers>';
示例6: while
echo "<select name='countryId1'>";
echo "<option value='0'>Select Visit</option>";
while ($row = $result->fetch_assoc()) {
unset($id, $name);
$id = $row['id'];
$name = $row['organisation'];
echo '<option value="' . $id . '">' . $name . '</option>';
}
echo "</select>";
} else {
header("Content-type: text/xml");
echo '<markers>';
// Iterate through the rows, printing XML nodes for each
while ($row = @mysqli_fetch_assoc($result)) {
// ADD TO XML DOCUMENT NODE
echo '<marker ';
echo 'ID="' . $row['id'] . '" ';
echo 'date2="' . $row['datee2'] . '" ';
echo 'vanue="' . parseToXML($row['vanue']) . '" ';
echo 'lat="' . $row['lat'] . '" ';
echo 'lng="' . $row['lng'] . '" ';
echo 'date1="' . parseToXML($row['datee1']) . '" ';
echo 'organisation="' . parseToXML($row['organisation']) . '" ';
echo 'delegation="' . parseToXML($row['delegation']) . '" ';
echo 'purpose="' . parseToXML($row['purpose']) . '" ';
echo 'outcomes="' . parseToXML($row['outcomes']) . '" ';
echo '/>';
}
// End XML file
echo '</markers>';
}
示例7: mysql_query
}
}
}
$result = mysql_query($query);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
setlocale(LC_MONETARY, 'en_US');
header("Content-type: text/xml");
// Start XML file, echo parent node
echo '<markers>';
// Iterate through the rows, printing XML nodes for each
while ($row = @mysql_fetch_assoc($result)) {
// ADD TO XML DOCUMENT NODE
echo '<marker ';
echo 'SALEDT="' . parseToXML($row['SALEDT']) . '" ';
echo 'PARCELLOCATION="' . parseToXML($row['PARCELLOCATION']) . '" ';
echo 'PARID="' . parseToXML($row['PARID']) . '" ';
echo 'PRICE="' . money_format('%(#10n', $row['PRICE']) . '" ';
echo 'SALETYPE="' . translateSaleType($row['SALETYPE']) . '" ';
echo 'SALEVALIDITY="' . translateSaleValidity($row['SALEVALIDITY']) . '" ';
echo 'SALETYPEnum="' . parseToXML($row['SALETYPE']) . '" ';
echo 'SALEVALIDITYnum="' . parseToXML($row['SALEVALIDITY']) . '" ';
echo 'PRICEnum="' . parseToXML($row['PRICE']) . '" ';
echo 'Latitude="' . $row['Latitude'] . '" ';
echo 'Longitude="' . $row['Longitude'] . '" ';
echo '/>';
}
// End XML file
echo '</markers>';
// http://www.tizag.com/ajaxTutorial/ajax-mysql-database.php
示例8: parseToXML
include 'includes/session.inc';
include 'includes/SQL_CommonFunctions.inc';
function parseToXML($htmlStr)
{
$xmlStr = str_replace('<', '<', $htmlStr);
$xmlStr = str_replace('>', '>', $xmlStr);
$xmlStr = str_replace('"', '"', $xmlStr);
$xmlStr = str_replace("'", ''', $xmlStr);
$xmlStr = str_replace("&", '&', $xmlStr);
return $xmlStr;
}
$sql = "SELECT * FROM suppliers WHERE 1";
$ErrMsg = _('An error occurred in retrieving the information');
$result = DB_query($sql, $db, $ErrMsg);
$myrow = DB_fetch_array($result);
header("Content-type: text/xml");
// Start XML file, echo parent node
echo '<markers>';
// Iterate through the rows, printing XML nodes for each
while ($myrow = @mysql_fetch_assoc($result)) {
// ADD TO XML DOCUMENT NODE
echo '<marker ';
echo 'name="' . parseToXML($myrow['suppname']) . '" ';
echo 'address="' . parseToXML($myrow["address1"] . ", " . $myrow["address2"] . ", " . $myrow["address3"] . ", " . $myrow["address4"]) . '" ';
echo 'lat="' . $myrow['lat'] . '" ';
echo 'lng="' . $myrow['lng'] . '" ';
echo 'type="' . $myrow['type'] . '" ';
echo '/>';
}
// End XML file
echo '</markers>';
示例9: die
die('Nao eh possivel usar o DB: ' . mysql_error());
}
//Seleciona todas as linhas na tabela de objetos
$query = "SELECT * FROM objeto WHERE 1";
$result = mysql_query($query);
if (!$result) {
die('Query Invalida: ' . mysql_error());
}
header("Content-type: text/xml");
//Comecando o arquivo XML
echo '<markers>';
//Iteracoes entre as linhas adicionando nohs XML para cada uma delas
while ($row = @mysql_fetch_assoc($result)) {
//Adicionando a um noh de documento XML
//$node = $doc->create_element("marker");
//$newnode = $parnode->append_child($node);
//$newnode->set_attribute("id", $row['id']);
//$newnode->set_attribute("tipo", $row['tipo']);
//$newnode->set_attribute("latitude", $row['latitude']);
//$newnode->set_attribute("longitude", $row['longitude']);
echo '<marker ';
echo 'id="' . parseToXML($row['id']) . '" ';
echo 'tipo="' . parseToXML($row['tipo']) . '" ';
echo 'latitude="' . $row['latitude'] . '" ';
echo 'longitude="' . $row['longitude'] . '" ';
echo '/>';
}
//$xmlfile = $doc->dump_mem();
//echo $xmlfile;
//Fim do arquivo XML
echo '</markers>';
示例10: parseToXML
//----------------------------------------------------//
include $DOC_ROOT . '/classes/userClass.php';
//-------------function to parse strings to xml-----------//
function parseToXML($htmlStr)
{
$xmlStr = str_replace('<', '<', $htmlStr);
$xmlStr = str_replace('>', '>', $xmlStr);
$xmlStr = str_replace('"', '"', $xmlStr);
$xmlStr = str_replace("'", ''', $xmlStr);
$xmlStr = str_replace("&", '&', $xmlStr);
return $xmlStr;
}
//Start XML file, echo parent node
header("Content-type: text/xml");
echo "<?xml version='1.0' encoding='ISO-8859-1'?>";
echo "<markers>\n";
$sql = user::searchAll();
$resource1 = mysql_query($sql);
while (@($row = mysql_fetch_assoc($resource1))) {
//-------------------selects users friends address--------------//
$address = $row['address1'] . " " . $row['address2'] . ", " . $row['city'] . ", " . $row['state'];
echo '<marker ';
echo 'address="' . parseToXML($address) . '" ';
echo 'name="' . parseToXML($row['item_name']) . '" ';
echo 'lat="' . parseToXML($row['latitude']) . '" ';
echo 'lng="' . parseToXML($row['longitude']) . '"';
echo "/>";
}
//--------------select user address ends---------------------//
// End XML file*/
echo "</markers>\n";
示例11: mysql_query
// Select all the rows in the markers table
$query = "SELECT * FROM landpks_input_data WHERE boolean_test_plot = 0";
$result = mysql_query($query);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
mysql_close($connection);
header("Content-type: text/xml");
// Start XML file, echo parent node
echo '<plots>';
// Iterate through the rows, printing XML nodes for each
while ($row = @mysql_fetch_assoc($result)) {
// ADD TO XML DOCUMENT NODE
echo '<plot ';
echo 'name="' . parseToXML(parseName($row['name'])) . '" ';
echo 'recorder_name="' . parseToXML($row['recorder_name']) . '" ';
echo 'lat="' . $row['latitude'] . '" ';
echo 'lng="' . $row['longitude'] . '" ';
echo 'slope="' . $row['slope'] . '" ';
echo 'slope_shape="' . $row['slope_shape'] . '" ';
echo 'land_cover="' . $row['land_cover'] . '" ';
if ($row['boolean_grazed'] == 1) {
echo 'grazed= "Yes" ';
} else {
echo 'grazed= "No" ';
}
if ($row['boolean_flooding'] == 1) {
echo 'flooding= "Yes" ';
} else {
echo 'flooding= "No" ';
}
示例12: die
if (!$result) {
die('Invalid query: ' . mysql_error());
}
// Start XML file, echo parent node
echo "<markers>\n";
// Iterate through the rows, printing XML nodes for each
while ($row = @mysql_fetch_assoc($result)){
// ADD TO XML DOCUMENT NODE
echo '<marker ';
echo 'name="' . parseToXML($row['sl_store']) . '" ';
echo 'address="' . parseToXML($row['sl_address']) . ', '. parseToXML($row['sl_city']). ', ' .parseToXML($row['sl_state']).' ' .parseToXML($row['sl_zip']).'" ';
echo 'lat="' . $row['sl_latitude'] . '" ';
echo 'lng="' . $row['sl_longitude'] . '" ';
echo 'distance="' . $row['sl_distance'] . '" ';
echo 'description="' . parseToXML($row['sl_description']) . '" ';
echo 'url="' . parseToXML($row['sl_url']) . '" ';
echo 'hours="' . parseToXML($row['sl_hours']) . '" ';
echo 'phone="' . parseToXML($row['sl_phone']) . '" ';
echo 'image="' . parseToXML($row['sl_image']) . '" ';
echo "/>\n";
}
// End XML file
echo "</markers>\n";
/*include("$sl_upload_path/cache/cacher-end.php");
*/
?>
示例13: str_replace
$xmlStr = str_replace('"', '"', $xmlStr);
$xmlStr = str_replace("'", ''', $xmlStr);
$xmlStr = str_replace("&", '&', $xmlStr);
return htmlspecialchars($xmlStr);
}
// Set the active MySQL database
$db_selected = mysql_select_db($database, $connection);
if (!$db_selected) {
die('Can\'t use db : ' . mysql_error());
}
// Select all the rows in the markers table
$query = "SELECT * FROM markers WHERE 1";
$result = mysql_query($query);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
header("Content-type: text/xml");
// Start XML file, echo parent node
echo '<markers>';
// Iterate through the rows, printing XML nodes for each
while ($row = @mysql_fetch_assoc($result)) {
// ADD TO XML DOCUMENT NODE
echo '<marker ';
echo 'name="' . parseToXML($row['name']) . '" ';
echo 'latlng="' . $row['latlng'] . '" ';
echo 'country="' . $row['country'] . '" ';
echo '/>';
}
// End XML file
echo '</markers>';
//
示例14: mysqli_query
if ($region == 100) {
$queryMap = "SELECT * FROM outgoingExchange WHERE '1'";
$resultMap = mysqli_query($irms, $queryMap);
} else {
$queryMap = "SELECT * FROM outgoingExchange WHERE regionid='{$region}'";
$resultMap = mysqli_query($irms, $queryMap);
}
if (!$resultMap) {
die('Invalid query: ' . mysqli_error($irms));
}
header("Content-type: text/xml");
// Start XML file, echo parent node
echo '<markers>';
// Iterate through the rows, printing XML nodes for each
while ($row = @mysqli_fetch_assoc($resultMap)) {
// ADD TO XML DOCUMENT NODE
echo '<marker ';
echo 'name="' . parseToXML($row['hostInstitution']) . '" ';
echo 'URLaddress="' . $row['uniURL'] . '" ';
echo 'lat="' . $row['lat'] . '" ';
echo 'lng="' . $row['lng'] . '" ';
echo 'unilogo="' . parseToXML($row['unilogo']) . '" ';
echo 'fldCountry="' . parseToXML($row['country']) . '" ';
echo 'fldRegion="' . parseToXML($row['regionid']) . '" ';
echo '/>';
}
// End XML file
echo '</markers>';
?>
示例15: foreach
foreach ($hostArray as $host) {
$icon = array();
//Check if google icon is used first
//else a custom icon is used and we need to parse.
if ($host->status == "up") {
$icon = explode('.', $host->upimage);
} elseif ($host->status == "down") {
$icon = explode('.', $host->downimage);
} elseif ($host->status == "recovering") {
$icon = explode('.', $host->recoverimage);
} else {
$icon = explode('.', $host->upimage);
}
if (!strncmp("Google", $icon[0], 6)) {
$icon[0] = strtolower(substr($icon[0], 6));
}
$kmldoc .= "<Placemark>";
$kmldoc .= '<name>' . parseToXML($host->description) . '</name>';
$kmldoc .= "<styleUrl>" . parseToXml($icon[0]) . "</styleUrl> ";
$kmldoc .= '<description>' . parseToXML($host->description) . "\n" . 'Availability: ' . $host->avail . "\n" . 'Address: ' . parseToXML($host->hostname) . '</description>';
$kmldoc .= '<Point>';
$kmldoc .= '<coordinates>' . parseToXML($host->long) . ',' . parseToXML($host->lat) . '</coordinates>';
$kmldoc .= '</Point>';
$kmldoc .= '</Placemark>';
$kmldoc .= "\n";
}
}
$kmldoc .= "</Document></kml>";
$f = fopen("./plugins/gpsmap/XML/" . $preemptive . ".kml", "w");
fwrite($f, $kmldoc);
fclose($f);