本文整理汇总了PHP中xmlwriter_start_element函数的典型用法代码示例。如果您正苦于以下问题:PHP xmlwriter_start_element函数的具体用法?PHP xmlwriter_start_element怎么用?PHP xmlwriter_start_element使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xmlwriter_start_element函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: dataElement
/**
* Make recursive elements
* @param array $data Data
*/
function dataElement($data, $last_tag)
{
if (!empty($data)) {
foreach ($data as $key => $val) {
$last_tag = !is_int($key) ? $key : $last_tag;
if ($last_tag != '') {
if (is_scalar($val) || is_null($val)) {
xmlwriter_start_element($this->xml, $last_tag);
$this->xmlwriter_write_cdata($val);
xmlwriter_end_element($this->xml);
} elseif (is_array($val)) {
if (!is_int(key($val))) {
xmlwriter_start_element($this->xml, $last_tag);
$this->dataElement($val, $last_tag);
xmlwriter_end_element($this->xml);
} else {
$this->dataElement($val, $last_tag);
}
}
}
}
}
}
开发者ID:MichaelFichtner,项目名称:RadioLaFamilia,代码行数:27,代码来源:xmlwrite.class.php
示例3: dirname
<?php
$file = dirname(__FILE__) . '/010.tmp';
$xw = xmlwriter_open_uri($file);
var_dump(xmlwriter_start_element($xw, "tag"));
var_dump(xmlwriter_start_attribute($xw, "attr"));
var_dump(xmlwriter_end_attribute($xw));
var_dump(xmlwriter_start_attribute($xw, "-1"));
var_dump(xmlwriter_end_attribute($xw));
var_dump(xmlwriter_start_attribute($xw, "\""));
var_dump(xmlwriter_end_attribute($xw));
var_dump(xmlwriter_end_element($xw));
unset($xw);
var_dump(file_get_contents($file));
@unlink($file);
echo "Done\n";
开发者ID:badlamer,项目名称:hhvm,代码行数:16,代码来源:010.php
示例4: instruction
<?php
/* $Id$ */
/*
Libxml 2.6.24 and up adds a new line after a processing instruction (PI)
*/
$xw = xmlwriter_open_memory();
xmlwriter_set_indent($xw, TRUE);
xmlwriter_start_document($xw, NULL, "UTF-8");
xmlwriter_start_element($xw, 'root');
xmlwriter_write_attribute($xw, 'id', 'elem1');
xmlwriter_start_element($xw, 'elem1');
xmlwriter_write_attribute($xw, 'attr1', 'first');
xmlwriter_write_comment($xw, 'start PI');
xmlwriter_start_element($xw, 'pi');
xmlwriter_write_pi($xw, 'php', 'echo "hello world"; ');
xmlwriter_end_element($xw);
xmlwriter_start_element($xw, 'cdata');
xmlwriter_start_cdata($xw);
xmlwriter_text($xw, '<>&"');
xmlwriter_end_cdata($xw);
xmlwriter_end_element($xw);
xmlwriter_end_element($xw);
xmlwriter_end_element($xw);
xmlwriter_end_document($xw);
// Force to write and empty the buffer
$output = xmlwriter_flush($xw, true);
print $output;
开发者ID:badlamer,项目名称:hhvm,代码行数:28,代码来源:009.php
示例5: 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
示例6: xmlwriter_open_uri
<?php
/* $Id$ */
$doc_dest = '001.xml';
$xw = xmlwriter_open_uri($doc_dest);
xmlwriter_start_dtd($xw, 'foo', NULL, 'urn:bar');
xmlwriter_end_dtd($xw);
xmlwriter_start_element($xw, 'foo');
xmlwriter_write_element_ns($xw, 'foo', 'bar', 'urn:foo', 'dummy content');
xmlwriter_end_element($xw);
// Force to write and empty the buffer
$output_bytes = xmlwriter_flush($xw, true);
echo file_get_contents($doc_dest);
unset($xw);
unlink('001.xml');
开发者ID:gleamingthecube,项目名称:php,代码行数:15,代码来源:ext_xmlwriter_tests_006.php
示例7: xmlwriter_open_memory
<?php
/* $Id$ */
$xw = xmlwriter_open_memory();
xmlwriter_set_indent($xw, TRUE);
xmlwriter_set_indent_string($xw, ' ');
xmlwriter_start_document($xw, '1.0', "UTF-8");
xmlwriter_start_element($xw, 'root');
xmlwriter_start_element_ns($xw, 'ns1', 'child1', 'urn:ns1');
xmlwriter_write_attribute_ns($xw, 'ns1', 'att1', 'urn:ns1', '<>"\'&');
xmlwriter_write_element($xw, 'chars', "special characters: <>\"'&");
xmlwriter_end_element($xw);
xmlwriter_end_document($xw);
// Force to write and empty the buffer
$output = xmlwriter_flush($xw, true);
print $output;
开发者ID:gleamingthecube,项目名称:php,代码行数:16,代码来源:ext_xmlwriter_tests_011.php
示例8: xmlwriter_open_memory
<?php
$xw = xmlwriter_open_memory();
xmlwriter_start_document($xw, NULL, "UTF-8");
xmlwriter_start_dtd($xw, "root");
xmlwriter_write_dtd_entity($xw, "ent2", "val2");
xmlwriter_end_dtd($xw);
xmlwriter_start_element($xw, "root");
xmlwriter_end_document($xw);
print xmlwriter_flush($xw, true);
print "\n";
$xw = new XMLWriter();
$xw->openMemory();
$xw->startDocument(NULL, "UTF-8");
$xw->startDtd("root");
$xw->writeDtdEntity("c", NULL, 0, "-//W3C//TEXT copyright//EN", "http://www.w3.org/xmlspec/copyright.xml");
$xw->endDtd();
$xw->startElement("root");
$xw->endDocument();
print $xw->flush(true);
开发者ID:badlamer,项目名称:hhvm,代码行数:20,代码来源:bug39504.php
示例9: xmlwriter_start_document
xmlwriter_start_document($xw, '1.0', 'UTF-8');
// A first element
xmlwriter_start_element($xw, 'tag1');
// Attribute 'att1' for element 'tag1'
xmlwriter_start_attribute($xw, 'att1');
xmlwriter_text($xw, 'valueofatt1');
xmlwriter_end_attribute($xw);
xmlwriter_write_comment($xw, 'this is a comment.');
// Start a child element
xmlwriter_start_element($xw, 'tag11');
xmlwriter_text($xw, utf8_encode('This is a sample text, ä'));
xmlwriter_end_element($xw);
// tag11
xmlwriter_end_element($xw);
// tag1
// CDATA
xmlwriter_start_element($xw, 'testc');
xmlwriter_write_cdata($xw, "This is a cdata content");
xmlwriter_end_element($xw);
// testctag
xmlwriter_start_element($xw, 'testc');
xmlwriter_start_cdata($xw);
xmlwriter_text($xw, "test cdata2");
xmlwriter_end_cdata($xw);
xmlwriter_end_element($xw);
// testctag
// A processing instruction
xmlwriter_start_pi($xw, 'php');
xmlwriter_text($xw, '$foo=2;echo $foo;');
xmlwriter_end_pi($xw);
xmlwriter_end_document($xw);
开发者ID:cefalo19,项目名称:php-src,代码行数:31,代码来源:xmlwriter_file.php
示例10: xmlwriter_open_memory
<?php
$xw = xmlwriter_open_memory();
xmlwriter_set_indent($xw, TRUE);
xmlwriter_start_document($xw, NULL, "UTF-8");
xmlwriter_start_element($xw, 'root');
xmlwriter_write_attribute_ns($xw, 'prefix', '', 'http://www.php.net/uri');
xmlwriter_start_element($xw, 'elem1');
xmlwriter_write_attribute($xw, 'attr1', 'first');
xmlwriter_end_element($xw);
xmlwriter_full_end_element($xw);
xmlwriter_end_document($xw);
$output = xmlwriter_flush($xw, true);
print $output;
// write attribute_ns without start_element first
$xw = xmlwriter_open_memory();
var_dump(xmlwriter_write_attribute_ns($xw, 'prefix', 'id', 'http://www.php.net/uri', 'elem1'));
print xmlwriter_output_memory($xw);
开发者ID:badlamer,项目名称:hhvm,代码行数:18,代码来源:xmlwriter_write_attribute_ns_error_001.php
示例11: xmlwriter_open_memory
<?php
/* $Id$ */
$xw = xmlwriter_open_memory();
xmlwriter_set_indent($xw, TRUE);
xmlwriter_set_indent_string($xw, ' ');
xmlwriter_start_document($xw, '1.0', "UTF-8");
xmlwriter_start_element($xw, 'root');
xmlwriter_start_element_ns($xw, 'ns1', 'child1', 'urn:ns1');
xmlwriter_write_attribute_ns($xw, 'ns1', 'att1', 'urn:ns1', '<>"\'&');
xmlwriter_write_element($xw, 'chars', "special characters: <>\"'&");
xmlwriter_end_element($xw);
xmlwriter_start_element($xw, 'empty');
xmlwriter_full_end_element($xw);
xmlwriter_full_end_element($xw);
// Force to write and empty the buffer
$output = xmlwriter_flush($xw, true);
print $output;
开发者ID:gleamingthecube,项目名称:php,代码行数:18,代码来源:ext_xmlwriter_tests_012.php
示例12: xmlwriter_open_memory
<?php
$writer = xmlwriter_open_memory();
xmlwriter_set_indent_string($writer, '#');
// The second arg is supposedly required. But just keep executing anyway and use
// the previous value...
xmlwriter_set_indent_string($writer);
xmlwriter_set_indent($writer, true);
xmlwriter_start_document($writer, '1.0');
xmlwriter_start_element($writer, 'foo');
xmlwriter_start_element($writer, 'bar');
xmlwriter_end_element($writer);
xmlwriter_end_element($writer);
xmlwriter_end_document($writer);
var_dump(xmlwriter_output_memory($writer));
开发者ID:badlamer,项目名称:hhvm,代码行数:15,代码来源:set_indent_string_error.php
示例13: VERIFY
VERIFY(xmlwriter_write_element($xml, "subnode", "some text"));
VERIFY(xmlwriter_end_element($xml));
VERIFY(xmlwriter_start_element_ns($xml, "fb", "node", "http://www.facebook.com/"));
VERIFY(xmlwriter_write_attribute_ns($xml, "fb", "attr", "http://www.facebook.com/", "value"));
VERIFY(xmlwriter_start_attribute_ns($xml, "fb", "attr2", "http://www.facebook.com/"));
VERIFY(xmlwriter_end_attribute($xml));
VERIFY(xmlwriter_write_element_ns($xml, "prefix", "name", "http://some.url/", 1337));
VERIFY(xmlwriter_start_element($xml, "node"));
VERIFY(xmlwriter_full_end_element($xml));
VERIFY(xmlwriter_end_element($xml));
VERIFY(xmlwriter_start_element($xml, "node"));
VERIFY(xmlwriter_start_cdata($xml));
VERIFY(xmlwriter_text($xml, "Raw text"));
VERIFY(xmlwriter_end_cdata($xml));
VERIFY(xmlwriter_end_element($xml));
VERIFY(xmlwriter_start_element($xml, "node"));
VERIFY(xmlwriter_write_cdata($xml, "More CDATA"));
VERIFY(xmlwriter_end_element($xml));
VERIFY(xmlwriter_start_comment($xml));
VERIFY(xmlwriter_text($xml, "Comments"));
VERIFY(xmlwriter_end_comment($xml));
VERIFY(xmlwriter_write_comment($xml, "More comments"));
VERIFY(xmlwriter_start_pi($xml, "lol"));
VERIFY(xmlwriter_end_pi($xml));
VERIFY(xmlwriter_write_pi($xml, "php", "print 'Hello world!';"));
VERIFY(xmlwriter_write_raw($xml, "<node>Raw XML</node>"));
VERIFY(xmlwriter_write_dtd($xml, "name", "publicID", "systemID", "subset"));
VERIFY(xmlwriter_start_dtd($xml, "name", "publicID", "systemID"));
VERIFY(xmlwriter_end_dtd($xml));
VERIFY(xmlwriter_start_dtd_element($xml, "name"));
VERIFY(xmlwriter_end_dtd_element($xml));
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:xmlwriter_procedural.php
示例14: api_xml3_render_object
/**
* Renders an xml_element structure to XMLWriter memory. This
* basically acts as a wrapper for api_xml2_render_object, first
* parsing through xml_element layers and then calling api_xml2_render_object
* to actually render the objects and arrays found.
*
* @param $xml_memory the xmlwriter memory to use (created with xmlwriter_open_memory())
* @param $object the xml_element to be rendered
*/
function api_xml3_render_object($xml_memory, $object)
{
if (is_array($object->value) && isset($object->value[0]) && $object->value[0] instanceof xml_element) {
xmlwriter_start_element($xml_memory, $object->name);
if (isset($object->attrs)) {
foreach ($object->attrs as $k => $v) {
xmlwriter_write_attribute($xml_memory, $k, $v);
}
}
foreach ($object->value as $elem) {
api_xml3_render_object($xml_memory, $elem);
}
xmlwriter_end_element($xml_memory);
} else {
api_xml2_render_object($xml_memory, $object->name, $object->value, $object->attrs);
}
}
开发者ID:luxurymask,项目名称:platform,代码行数:26,代码来源:api_xml.php
示例15: 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
示例16: xmlwriter_open_uri
<?php
$xw = xmlwriter_open_uri('./a.xml');
xmlwriter_set_indent($xw, 1);
$res = xmlwriter_set_indent_string($xw, ' ');
xmlwriter_start_document($xw, '1.0', 'utf8');
// A first element
xmlwriter_start_element($xw, 'tag1');
// Attribute 'att1' for element 'tag1'
xmlwriter_start_attribute($xw, 'att1');
xmlwriter_text($xw, 'valueofatt1');
xmlwriter_end_attribute($xw);
xmlwriter_write_comment($xw, 'this is a comment.');
// Start a child element
xmlwriter_start_element($xw, 'tag11');
xmlwriter_text($xw, utf8_encode('This is a sample text, ä'));
xmlwriter_end_element($xw);
// tag11
xmlwriter_end_element($xw);
// tag1
// partial example
开发者ID:exakat,项目名称:exakat,代码行数:21,代码来源:Extxmlwriter.01.php
示例17: 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
示例18: toxml
/**
* Take an array of any size, and make it into xml
* @param xmlwriter An xmlwriter instance
* @param array The array which is to be transformed
* @param mixed Either a string, or an array of elements defining element names for each level in the XML hierarchy
* In the case of multiple lists of differently titled items at the same level, adding an array inside the array will allow for this to be constructed.
* @param int Internal use (the index of the child item in question - corresponds to the index in the second level array above)
*/
public function toxml($writer, $data, $node, $childindex = 0)
{
$nodename = $node;
if (is_array($node)) {
$nodename = array_shift($node);
}
$childcount = -1;
foreach ($data as $key => $value) {
$childcount++;
if (is_numeric($key)) {
if (is_array($nodename)) {
$key = $nodename[$childindex];
} else {
$key = $nodename;
}
}
if (is_array($value)) {
xmlwriter_start_element($writer, $key);
$this->toxml($writer, $value, $node, $childcount);
xmlwriter_end_element($writer);
} else {
xmlwriter_write_element($writer, $key, $value);
}
}
if (is_array($node)) {
array_unshift($node, $nodename);
}
}
开发者ID:KDE,项目名称:ocs-server,代码行数:36,代码来源:lib_ocs.class.php
示例19: xmlwriter_open_memory
<?php
// use xmlwriter_open_uri() for direct file writes
$w = xmlwriter_open_memory();
xmlwriter_set_indent($w, TRUE);
xmlwriter_start_element($w, "source");
xmlwriter_start_element($w, "php");
// add raw data via CDATA
xmlwriter_start_cdata($w);
xmlwriter_text($w, "<?php phpinfo(); ?>");
xmlwriter_end_cdata($w);
xmlwriter_end_element($w);
xmlwriter_end_element($w);
echo '<pre>' . htmlentities(xmlwriter_output_memory($w)) . '</pre>';
开发者ID:SandyS1,项目名称:presentations,代码行数:14,代码来源:xmlwrite2.php
示例20: toXml
public static function toXml($writer, $data, $node)
{
foreach ($data as $key => $value) {
if (is_numeric($key)) {
$key = $node;
}
if (is_array($value)) {
xmlwriter_start_element($writer, $key);
OC_OCS::toxml($writer, $value, $node);
xmlwriter_end_element($writer);
} else {
xmlwriter_write_element($writer, $key, $value);
}
}
}
开发者ID:ryanshoover,项目名称:core,代码行数:15,代码来源:ocs.php
注:本文中的xmlwriter_start_element函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论