本文整理汇总了PHP中xmlwriter_open_memory函数的典型用法代码示例。如果您正苦于以下问题:PHP xmlwriter_open_memory函数的具体用法?PHP xmlwriter_open_memory怎么用?PHP xmlwriter_open_memory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xmlwriter_open_memory函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _create_jasper_info
/**
* create jasper config information used for input for executing the report
*
* @param string $report_source full path to the jrxml-report definition file
*
* @return array Array with referense to the config-file and report name
*/
protected static function _create_jasper_info($report_source)
{
$info = pathinfo($report_source);
$base_name = basename($report_source, '.' . $info['extension']);
$report_name = "report_{$base_name}";
$memory = xmlwriter_open_memory();
xmlwriter_start_document($memory, '1.0', 'UTF-8');
xmlwriter_start_element($memory, 'JasperConfig');
// <JasperConfig>
xmlwriter_start_element($memory, 'Reports');
// <Reports>
xmlwriter_start_element($memory, 'Report');
// <Report>
xmlwriter_write_attribute($memory, 'name', $report_name);
xmlwriter_write_attribute($memory, 'source', $report_source);
xmlwriter_end_element($memory);
// </Report>
xmlwriter_end_element($memory);
// </Reports>
xmlwriter_end_element($memory);
// </JasperConfig>
$xml = xmlwriter_output_memory($memory, true);
$jasper_info = array('config' => $GLOBALS['phpgw_info']['server']['temp_dir'] . '/' . uniqid('config_') . "{$base_name}.xml", 'report_name' => $report_name);
$fp = fopen($jasper_info['config'], "wb");
fwrite($fp, $xml);
if (!fclose($fp)) {
throw new Exception('jasper_wrapper::create_jasper_config did not write any config file');
}
return $jasper_info;
}
开发者ID:HaakonME,项目名称:porticoestate,代码行数:37,代码来源:class.jasper_wrapper.inc.php
示例2: FirstContact
function FirstContact()
{
global $db, $xmlout;
$db->init_log(1);
$time = localtime(time(), true);
$VerifyID = $time['tm_min'] + $time['tm_sec'];
$RecordID = $db->add_usage_record($VerifyID);
$memory = xmlwriter_open_memory();
xmlwriter_start_document($memory, '1.0', 'UTF-8');
xmlwriter_write_dtd($memory, "AWB");
xmlwriter_start_element($memory, "DB");
xmlwriter_write_attribute($memory, "Record", $RecordID);
xmlwriter_write_attribute($memory, "Verify", $VerifyID);
xmlwriter_end_element($memory);
$xmlout = xmlwriter_output_memory($memory, true);
}
开发者ID:reedy,项目名称:AutoWikiBrowserUsageStats,代码行数:16,代码来源:index.php
示例3: dl
<?php
dl('xmlwriter.so');
$xw = xmlwriter_open_memory();
xmlwriter_set_indent($xw, 1);
$res = xmlwriter_set_indent_string($xw, ' ');
xmlwriter_start_document($xw, '1.0', 'UTF-8');
// A first element
xmlwriter_start_element_ns($xw, 'prefix', 'books', 'uri');
xmlwriter_start_attribute($xw, 'isbn');
/* Uncomment this line if you have libxml 2.6.17 or CVS version
after 2005/02/22
earlier versions segfault
*/
/*
xmlwriter_start_attribute_ns($xw, 'prefix', 'isbn', 'uri');
xmlwriter_end_attribute($xw);
*/
xmlwriter_end_attribute($xw);
xmlwriter_text($xw, 'book1');
xmlwriter_end_element($xw);
xmlwriter_end_document($xw);
$out = xmlwriter_output_memory($xw, 0);
echo $out;
开发者ID:mig1098,项目名称:php-src,代码行数:24,代码来源:xmlwriter_mem_ns.php
示例4: testXMLWriterCanCreateOurNeededXML
/**
* We want to check that we get the expected structure from
* xmlwriter & an idea of how it works, once we have this
* down we can start working on the actual methods needed
* to authenticate.
*
*/
function testXMLWriterCanCreateOurNeededXML()
{
$xml = xmlwriter_open_memory();
xmlwriter_start_element($xml, 'Authentication');
xmlwriter_write_element($xml, 'client', 'blah');
xmlwriter_write_element($xml, 'password', 'blah');
xmlwriter_end_element($xml);
$result = xmlwriter_output_memory($xml, true);
$expected = '<Authentication><client>blah</client><password>blah</password></Authentication>';
$this->assertContains('Authentication', $result);
$this->assertXmlStringEqualsXmlString($expected, $result);
}
开发者ID:baphled,项目名称:datacashapi,代码行数:19,代码来源:DataCashApiTest.php
示例5: generaterss
/**
* @brief Generate an RSS feed
* @param string $link
* @param string $content
*/
public static function generaterss($link, $content)
{
$writer = xmlwriter_open_memory();
xmlwriter_set_indent($writer, 4);
xmlwriter_start_document($writer, '1.0', 'utf-8');
xmlwriter_start_element($writer, 'rss');
xmlwriter_write_attribute($writer, 'version', '2.0');
xmlwriter_write_attribute($writer, 'xmlns:atom', 'http://www.w3.org/2005/Atom');
xmlwriter_start_element($writer, 'channel');
xmlwriter_write_element($writer, 'title', 'my ownCloud');
xmlwriter_write_element($writer, 'language', 'en-us');
xmlwriter_write_element($writer, 'link', $link);
xmlwriter_write_element($writer, 'description', 'A personal ownCloud activities');
xmlwriter_write_element($writer, 'pubDate', date('r'));
xmlwriter_write_element($writer, 'lastBuildDate', date('r'));
xmlwriter_start_element($writer, 'atom:link');
xmlwriter_write_attribute($writer, 'href', $link);
xmlwriter_write_attribute($writer, 'rel', 'self');
xmlwriter_write_attribute($writer, 'type', 'application/rss+xml');
xmlwriter_end_element($writer);
// items
for ($i = 0; $i < count($content); $i++) {
xmlwriter_start_element($writer, 'item');
if (isset($content[$i]['subject'])) {
xmlwriter_write_element($writer, 'title', $content[$i]['subject']);
}
if (isset($content[$i]['link'])) {
xmlwriter_write_element($writer, 'link', $content[$i]['link']);
}
if (isset($content[$i]['link'])) {
xmlwriter_write_element($writer, 'guid', $content[$i]['link']);
}
if (isset($content[$i]['timestamp'])) {
xmlwriter_write_element($writer, 'pubDate', date('r', $content[$i]['timestamp']));
}
if (isset($content[$i]['message'])) {
xmlwriter_start_element($writer, 'description');
xmlwriter_start_cdata($writer);
xmlwriter_text($writer, $content[$i]['message']);
xmlwriter_end_cdata($writer);
xmlwriter_end_element($writer);
}
xmlwriter_end_element($writer);
}
xmlwriter_end_element($writer);
xmlwriter_end_element($writer);
xmlwriter_end_document($writer);
$entry = xmlwriter_output_memory($writer);
unset($writer);
return $entry;
}
开发者ID:hjimmy,项目名称:owncloud,代码行数:56,代码来源:data.php
示例6: process_request
private function process_request($request)
{
global $API_DOMAIN, $API_DOMAIN_DOT_SUFFIX;
$app_id = $this->app_id;
$method = $request['method'];
$callback = false;
$serialized_result = '';
// Initialize result
$result = array();
// Fix method name
if (starts_with($method, $API_DOMAIN . '.')) {
$method = substr($method, 9);
}
// Replace periods with underscores in method name
$method_underscore = str_replace('.', '_', $method);
$ec = $this->check_throttle($method_underscore, $request);
if ($ec !== API_EC_SUCCESS) {
$msg = $api_error_descriptions[$ec];
if ($ec === API_EC_BAD_IP) {
$msg .= ' (ip was: ' . $_SERVER['REMOTE_ADDR'] . ')';
}
throw new api10_FacebookApiException(array('error_code' => $ec, 'error_msg' => $msg));
}
$impl = new FacebookApi10Implementation($app_id, $this->user_id, $this->session_key, $this->format);
$api = new FacebookApi10Rest($impl);
// Check that the method is valid
if (!method_exists($api, $method_underscore) || !method_exists($impl, $method_underscore) || !api_can_call_method($app_id, $method_underscore)) {
$ec = api10_FacebookApiErrorCode::API_EC_METHOD;
throw new api10_FacebookApiException(array('error_code' => $ec, 'error_msg' => $GLOBALS['api_error_descriptions'][$ec]));
} else {
// Call the method and catch any exceptions
$result = $api->{$method_underscore}($request);
}
switch ($this->format) {
case 'manual':
print api_xml_render_manual_error($ec, $msg, $request);
break;
case 'xml':
// Prepare the XML response
$xml_memory = xmlwriter_open_memory();
xmlwriter_set_indent($xml_memory, true);
xmlwriter_set_indent_string($xml_memory, ' ');
xmlwriter_start_document($xml_memory, API_VERSION_10, 'UTF-8');
if ($result instanceof Exception) {
$name = 'error_response';
} else {
$name = $method_underscore . '_response';
}
$attrs = array();
// FBOPEN:NOTE here, if you are not publishing your own .xsd, to use 'facebook.com' instead
// of $API_DOMAIN_DOT_SUFFIX
$attrs['xmlns'] = 'http://api.' . $API_DOMAIN_DOT_SUFFIX . '/' . API_VERSION_10 . '/';
$attrs['xmlns:xsi'] = 'http://www.w3.org/2001/XMLSchema-instance';
if ($method_underscore != 'fql_query') {
$attrs['xsi:schemaLocation'] = 'http://api.' . $API_DOMAIN_DOT_SUFFIX . '/' . API_VERSION_10 . '/ http://api.' . $API_DOMAIN_DOT_SUFFIX . '/' . API_VERSION_10 . '/facebook.xsd';
}
if (is_array($result) && isset($result[0]) && $result[0] instanceof xml_element) {
$attrs['list'] = 'true';
api_xml3_render_object($xml_memory, new xml_element($name, $result, $attrs));
} else {
api_xml2_render_object($xml_memory, $name, $result, $attrs);
}
xmlwriter_end_document($xml_memory);
// Write XML response
$xml = xmlwriter_output_memory($xml_memory, true);
if ($callback) {
$xml = addslashes($xml);
$xml = str_replace("\n", '\\n', $xml);
$serialized_result = $callback . '(\'' . $xml . '\');';
} else {
$serialized_result = $xml;
}
break;
case 'json':
$json = api_json2_render_object($result);
if ($callback) {
$serialized_result = $callback . '(' . $json . ');';
} else {
$serialized_result = $json;
}
break;
}
return $serialized_result;
}
开发者ID:luxurymask,项目名称:platform,代码行数:84,代码来源:implementation.php
示例7: xmlwriter_open_memory
<?php
$w = xmlwriter_open_memory("writer.xml");
xmlwriter_set_indent($w, true);
// verbose version
xmlwriter_start_element_ns($w, "dc", "subject", "http://purl.org/dc/elements/1.1/");
xmlwriter_text($w, "Verbose");
xmlwriter_end_element($w);
// simpler version
xmlwriter_write_element_ns($w, "dc", "subject", "http://purl.org/dc/elements/1.1/", "Simple");
echo '<pre>' . htmlentities(xmlwriter_output_memory($w)) . '</pre>';
开发者ID:SandyS1,项目名称:presentations,代码行数:11,代码来源:xmlwrite3.php
示例8: generateXml
/**
* generates the xml or json response for the API call from an multidimenional data array.
* @param string $format
* @param string $status
* @param string $statuscode
* @param string $message
* @param array $data
* @param string $tag
* @param string $tagattribute
* @param int $dimension
* @param int $itemscount
* @param int $itemsperpage
* @return string xml/json
*/
private static function generateXml($format, $status, $statuscode, $message, $data = array(), $tag = '', $tagattribute = '', $dimension = -1, $itemscount = '', $itemsperpage = '')
{
if ($format == 'json') {
$json = array();
$json['status'] = $status;
$json['statuscode'] = $statuscode;
$json['message'] = $message;
$json['totalitems'] = $itemscount;
$json['itemsperpage'] = $itemsperpage;
$json['data'] = $data;
return json_encode($json);
} else {
$txt = '';
$writer = xmlwriter_open_memory();
xmlwriter_set_indent($writer, 2);
xmlwriter_start_document($writer);
xmlwriter_start_element($writer, 'ocs');
xmlwriter_start_element($writer, 'meta');
xmlwriter_write_element($writer, 'status', $status);
xmlwriter_write_element($writer, 'statuscode', $statuscode);
xmlwriter_write_element($writer, 'message', $message);
if ($itemscount != '') {
xmlwriter_write_element($writer, 'totalitems', $itemscount);
}
if (!empty($itemsperpage)) {
xmlwriter_write_element($writer, 'itemsperpage', $itemsperpage);
}
xmlwriter_end_element($writer);
if ($dimension == '0') {
// 0 dimensions
xmlwriter_write_element($writer, 'data', $data);
} elseif ($dimension == '1') {
xmlwriter_start_element($writer, 'data');
foreach ($data as $key => $entry) {
xmlwriter_write_element($writer, $key, $entry);
}
xmlwriter_end_element($writer);
} elseif ($dimension == '2') {
xmlwriter_start_element($writer, 'data');
foreach ($data as $entry) {
xmlwriter_start_element($writer, $tag);
if (!empty($tagattribute)) {
xmlwriter_write_attribute($writer, 'details', $tagattribute);
}
foreach ($entry as $key => $value) {
if (is_array($value)) {
foreach ($value as $k => $v) {
xmlwriter_write_element($writer, $k, $v);
}
} else {
xmlwriter_write_element($writer, $key, $value);
}
}
xmlwriter_end_element($writer);
}
xmlwriter_end_element($writer);
} elseif ($dimension == '3') {
xmlwriter_start_element($writer, 'data');
foreach ($data as $entrykey => $entry) {
xmlwriter_start_element($writer, $tag);
if (!empty($tagattribute)) {
xmlwriter_write_attribute($writer, 'details', $tagattribute);
}
foreach ($entry as $key => $value) {
if (is_array($value)) {
xmlwriter_start_element($writer, $entrykey);
foreach ($value as $k => $v) {
xmlwriter_write_element($writer, $k, $v);
}
xmlwriter_end_element($writer);
} else {
xmlwriter_write_element($writer, $key, $value);
}
}
xmlwriter_end_element($writer);
}
xmlwriter_end_element($writer);
} elseif ($dimension == 'dynamic') {
xmlwriter_start_element($writer, 'data');
OC_OCS::toxml($writer, $data, 'comment');
xmlwriter_end_element($writer);
}
xmlwriter_end_element($writer);
xmlwriter_end_document($writer);
$txt .= xmlwriter_output_memory($writer);
unset($writer);
//.........这里部分代码省略.........
开发者ID:ryanshoover,项目名称:core,代码行数:101,代码来源:ocs.php
示例9: xmlwriter_open_memory
<?php
$xmlwriter = xmlwriter_open_memory();
var_dump(xmlwriter_write_dtd($xmlwriter));
开发者ID:badlamer,项目名称:hhvm,代码行数:4,代码来源:xmlwriter_write_dtd_error_001.php
示例10: xmlwriter_open_memory
<?php
/* $Id$ */
$doc_dest = '001.xml';
$xw = xmlwriter_open_memory($doc_dest);
xmlwriter_start_document($xw, '1.0', 'UTF-8');
xmlwriter_start_element($xw, "tag1");
xmlwriter_end_document($xw);
// Force to write and empty the buffer
echo xmlwriter_flush($xw, true);
?>
===DONE===
开发者ID:badlamer,项目名称:hhvm,代码行数:12,代码来源:002.php
示例11: makeXML_XMLWriter
/**
* Make XML document using built-in XMLWriter functionality
* @return string
*/
function makeXML_XMLWriter()
{
// XMLWriter object instance
$this->xml = xmlwriter_open_memory();
// Indentation
xmlwriter_set_indent($this->xml, $this->indent);
xmlwriter_set_indent_string($this->xml, $this->indent_string);
// XML Document declaration
xmlwriter_start_document($this->xml, '1.0', $this->encoding, 'yes');
// <ROOT>
xmlwriter_start_element($this->xml, $this->root_name);
// <header>
xmlwriter_start_element($this->xml, 'header');
// <service>
xmlwriter_start_element($this->xml, 'service');
$this->xmlwriter_write_cdata($this->header_service);
xmlwriter_end_element($this->xml);
// </service>
// <status>
xmlwriter_start_element($this->xml, 'status');
$this->xmlwriter_write_cdata($this->header_status);
xmlwriter_end_element($this->xml);
// </status>
// <message>
xmlwriter_start_element($this->xml, 'message');
$this->xmlwriter_write_cdata($this->header_message);
xmlwriter_end_element($this->xml);
// </message>
xmlwriter_end_element($this->xml);
// </header>
// <data>
xmlwriter_start_element($this->xml, 'data');
$this->dataElement($this->xml_data, '');
xmlwriter_end_element($this->xml);
// </data>
if (!empty($this->debug_timers) && is_array($this->debug_timers)) {
// <debug_timers>
xmlwriter_start_element($this->xml, 'debug_timers');
foreach ($this->debug_timers as $key => $val) {
xmlwriter_start_element($this->xml, $key);
$this->xmlwriter_write_cdata($val);
xmlwriter_end_element($this->xml);
}
xmlwriter_end_element($this->xml);
// </debug_timers>
}
xmlwriter_end_element($this->xml);
// <ROOT>
xmlwriter_end_document($this->xml);
// Finish XML document
// Generate XML string
return xmlwriter_output_memory($this->xml, true);
}
开发者ID:MichaelFichtner,项目名称:RadioLaFamilia,代码行数:57,代码来源:xmlwrite.class.php
示例12: get_xmldata
protected function get_xmldata($id = 0, $current_value)
{
$this->db =& $GLOBALS['phpgw']->db;
$id = (int) $id;
$sql = "SELECT * FROM fm_entity_1_11 WHERE id = {$id}";
$this->db->query($sql, __LINE__, __FILE__);
$anlegg = array();
$TreeID = $this->type;
$PeriodFrom = date('Ym');
if ($current_value) {
$PeriodTo = 209912;
} else {
$PeriodTo = '000000';
}
$memory = xmlwriter_open_memory();
xmlwriter_set_indent($memory, true);
xmlwriter_start_document($memory, '1.0', 'UTF-8');
xmlwriter_start_element($memory, 'TreeListe');
xmlwriter_write_attribute($memory, 'TreeID', $TreeID);
xmlwriter_write_attribute($memory, 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
xmlwriter_write_attribute($memory, 'xsi:noNamespaceSchemaLocation', 'TreeListe.xsd');
while ($this->db->next_record()) {
xmlwriter_start_element($memory, 'Tree');
xmlwriter_write_element($memory, 'ID', 'TJ');
xmlwriter_write_element($memory, 'Verdi', substr($this->db->f('maalepunkt_id'), -8));
xmlwriter_write_element($memory, 'Beskrivelse', $this->db->f('address'));
xmlwriter_write_element($memory, 'Firma', 'BB');
xmlwriter_write_element($memory, 'PeriodeFra', $PeriodFrom);
xmlwriter_write_element($memory, 'PeriodeTil', $PeriodTo);
xmlwriter_write_element($memory, 'Status', 'N');
xmlwriter_start_element($memory, 'BegrepsLister');
xmlwriter_start_element($memory, 'BegrepsListe');
xmlwriter_write_attribute($memory, 'Prosent', 100);
xmlwriter_start_element($memory, 'Begrep');
xmlwriter_write_comment($memory, 'Firma');
xmlwriter_write_element($memory, 'ID', 'A3');
xmlwriter_write_element($memory, 'Verdi', 'BB');
xmlwriter_end_element($memory);
xmlwriter_start_element($memory, 'Begrep');
xmlwriter_write_comment($memory, 'Art');
xmlwriter_write_element($memory, 'ID', 'A0');
xmlwriter_write_element($memory, 'Verdi', '12304121');
xmlwriter_end_element($memory);
xmlwriter_start_element($memory, 'Begrep');
xmlwriter_write_comment($memory, 'Asvar');
xmlwriter_write_element($memory, 'ID', 'C1');
xmlwriter_write_element($memory, 'Verdi', 45);
xmlwriter_end_element($memory);
xmlwriter_start_element($memory, 'Begrep');
xmlwriter_write_comment($memory, 'Tjeneste');
xmlwriter_write_element($memory, 'ID', 'TJE');
xmlwriter_write_element($memory, 'Verdi', '');
xmlwriter_end_element($memory);
xmlwriter_start_element($memory, 'Begrep');
xmlwriter_write_comment($memory, 'Objekt');
xmlwriter_write_element($memory, 'ID', 'F0');
xmlwriter_write_element($memory, 'Verdi', $this->db->f('loc1'));
xmlwriter_end_element($memory);
xmlwriter_start_element($memory, 'Begrep');
xmlwriter_write_comment($memory, 'Prosjekt');
xmlwriter_write_element($memory, 'ID', 'B0');
xmlwriter_write_element($memory, 'Verdi', '');
xmlwriter_end_element($memory);
xmlwriter_start_element($memory, 'Begrep');
xmlwriter_write_comment($memory, 'Fagkode');
xmlwriter_write_element($memory, 'ID', 'B1');
xmlwriter_write_element($memory, 'Verdi', '999');
xmlwriter_end_element($memory);
xmlwriter_start_element($memory, 'Begrep');
xmlwriter_write_comment($memory, 'AV');
xmlwriter_write_element($memory, 'ID', 'AV');
xmlwriter_write_element($memory, 'Verdi', '');
xmlwriter_end_element($memory);
xmlwriter_end_element($memory);
xmlwriter_end_element($memory);
xmlwriter_end_element($memory);
}
xmlwriter_end_element($memory);
$xml = xmlwriter_output_memory($memory, true);
if ($this->debug) {
header('Content-type: text/xml');
echo $xml;
die;
}
return $xml;
}
开发者ID:HaakonME,项目名称:porticoestate,代码行数:86,代码来源:LRS_oppdater_el_anlegg.php
示例13: set3DSecureAuthRequest
/**
* Sets our 3DSecure request to confirm the transaction.
*
* @param string $pares
* @param string $reference
* @param string $method
* @return SimpleXML
*
*/
function set3DSecureAuthRequest($pares, $reference, $method = 'deposits')
{
if (is_null($pares) || empty($pares)) {
throw new Zend_Exception('PaRes is not set');
}
if (strlen($reference) !== 16) {
throw new Zend_Exception('Reference must be 16 characters long');
}
$xml = xmlwriter_open_memory();
xmlwriter_start_element($xml, 'Request');
$auth = $this->_handleAuth($method);
xmlwriter_write_raw($xml, $auth);
xmlwriter_start_element($xml, 'Transaction');
xmlwriter_start_element($xml, 'HistoricTxn');
xmlwriter_write_element($xml, 'reference', $reference);
xmlwriter_start_element($xml, 'method');
xmlwriter_write_attribute($xml, 'tx_status_u', 'accept');
xmlwriter_write_raw($xml, 'threedsecure_authorization_request');
xmlwriter_end_element($xml);
xmlwriter_write_element($xml, 'pares_message', $pares);
xmlwriter_end_element($xml);
xmlwriter_end_element($xml);
xmlwriter_end_element($xml);
return xmlwriter_output_memory($xml, true);
}
开发者ID:baphled,项目名称:datacashapi,代码行数:34,代码来源:Api.php
注:本文中的xmlwriter_open_memory函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论