本文整理汇总了PHP中xml_set_default_handler函数的典型用法代码示例。如果您正苦于以下问题:PHP xml_set_default_handler函数的具体用法?PHP xml_set_default_handler怎么用?PHP xml_set_default_handler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xml_set_default_handler函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: open
function open($xml, $encoding = null)
{
if (!empty($encoding) && strtolower($encoding) != 'utf-8' && !Utils_Unicode::validate($xml)) {
if (preg_match('/^<\\?xml[^<]*\\s+encoding=["\']?([\\w-]+)["\']?/', $xml, $matches)) {
$encoding = $matches[1];
$xml = preg_replace('/^(<\\?xml[^<]*\\s+encoding=)["\']?[\\w-]+["\']?/', '$1"utf-8"', $xml, 1);
}
if (strcasecmp($encoding, 'utf-8')) {
$xml = Utils_Unicode::bring($xml, $encoding);
if (is_null($xml)) {
$this->error = XML_ERROR_UNKNOWN_ENCODING;
return false;
}
}
} else {
if (substr($xml, 0, 3) == "") {
$xml = substr($xml, 3);
}
}
$p = xml_parser_create();
xml_set_object($p, $this);
xml_parser_set_option($p, XML_OPTION_CASE_FOLDING, 0);
xml_set_element_handler($p, 'o', 'c');
xml_set_character_data_handler($p, 'd');
xml_set_default_handler($p, 'x');
$this->tree = array('children' => array());
$this->_cursor =& $this->tree;
$this->_cdata = false;
xml_parse($p, $xml);
unset($this->_cursor);
unset($this->_cdata);
$this->error = xml_get_error_code($p);
xml_parser_free($p);
return $this->error == XML_ERROR_NONE;
}
开发者ID:Avantians,项目名称:Textcube,代码行数:35,代码来源:Needlworks.PHP.XMLTree.php
示例2: parse
public function parse($html)
{
// replace entities
$html = preg_replace('/&([a-z0-9#]{2,5});/i', '+$1;', $html);
//before sending to xml parser make sure we have valid xml by tidying it up
$html = Kwf_Util_Tidy::repairHtml($html);
$this->_stack = array();
$this->_ret = '';
$this->_parser = xml_parser_create();
xml_set_object($this->_parser, $this);
xml_set_element_handler($this->_parser, 'startElement', 'endElement');
xml_set_character_data_handler($this->_parser, 'characterData');
xml_set_default_handler($this->_parser, 'characterData');
$result = xml_parse($this->_parser, '<body>' . $html . '</body>', true);
if (!$result) {
// wenn man ein nicht geschlossenes <br> rein gibt, schreit er hier,
// macht aber normal weiter. wenns zu oft vorkommt, evtl. exception
// entfernen und ignorieren, oder was andres überlegen :-)
$errorCode = xml_get_error_code($this->_parser);
$ex = new Kwf_Exception("HtmlExport UrlParser XML Error {$errorCode}: " . xml_error_string($errorCode) . "in line " . xml_get_current_line_number($this->_parser) . " parsed html: " . $html);
$ex->logOrThrow();
}
// re-replace entities
$this->_ret = preg_replace('/\\+([a-z0-9#]{2,5});/i', '&$1;', $this->_ret);
return $this->_ret;
}
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:26,代码来源:UrlParser.php
示例3: parse
function parse()
{
set_error_handler(array(&$this, 'error_handler'));
array_unshift($this->ns_contexts, array());
$parser = xml_parser_create_ns();
xml_set_object($parser, $this);
xml_set_element_handler($parser, "start_element", "end_element");
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0);
xml_set_character_data_handler($parser, "cdata");
xml_set_default_handler($parser, "_default");
xml_set_start_namespace_decl_handler($parser, "start_ns");
xml_set_end_namespace_decl_handler($parser, "end_ns");
$this->content = '';
$ret = true;
$fp = fopen($this->FILE, "r");
while ($data = fread($fp, 4096)) {
if ($this->debug) {
$this->content .= $data;
}
if (!xml_parse($parser, $data, feof($fp))) {
trigger_error(sprintf(__('XML error: %s at line %d') . "\n", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser)));
$ret = false;
break;
}
}
fclose($fp);
xml_parser_free($parser);
restore_error_handler();
return $ret;
}
开发者ID:helmonaut,项目名称:owb-mirror,代码行数:31,代码来源:atomlib.php
示例4: __construct
public function __construct($input, $maxDepth = 20)
{
if (!is_string($input)) {
throw new XmlToArrayException('No valid input.');
}
$this->_maxDepth = $maxDepth;
$XMLParser = xml_parser_create();
xml_parser_set_option($XMLParser, XML_OPTION_SKIP_WHITE, false);
xml_parser_set_option($XMLParser, XML_OPTION_CASE_FOLDING, false);
xml_parser_set_option($XMLParser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
xml_set_character_data_handler($XMLParser, array($this, '_contents'));
xml_set_default_handler($XMLParser, array($this, '_default'));
xml_set_element_handler($XMLParser, array($this, '_start'), array($this, '_end'));
xml_set_external_entity_ref_handler($XMLParser, array($this, '_externalEntity'));
xml_set_notation_decl_handler($XMLParser, array($this, '_notationDecl'));
xml_set_processing_instruction_handler($XMLParser, array($this, '_processingInstruction'));
xml_set_unparsed_entity_decl_handler($XMLParser, array($this, '_unparsedEntityDecl'));
if (!xml_parse($XMLParser, $input, true)) {
$errorCode = xml_get_error_code($XMLParser);
$message = sprintf('%s. line: %d, char: %d' . ($this->_tagStack ? ', tag: %s' : ''), xml_error_string($errorCode), xml_get_current_line_number($XMLParser), xml_get_current_column_number($XMLParser) + 1, implode('->', $this->_tagStack));
xml_parser_free($XMLParser);
throw new XmlToArrayException($message, $errorCode);
}
xml_parser_free($XMLParser);
}
开发者ID:rodhoff,项目名称:MNW,代码行数:25,代码来源:xml_to_array.php
示例5: XMLParser
function XMLParser()
{
$this->parser = xml_parser_create();
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, FALSE);
xml_set_element_handler($this->parser, "startElementhandler", "endElementHandler");
xml_set_character_data_handler($this->parser, "cdataHandler");
xml_set_processing_instruction_handler($this->parser, "processingInstructionHandler");
xml_set_default_handler($this->parser, "defaultHandler");
}
开发者ID:nbtscommunity,项目名称:phpfnlib,代码行数:9,代码来源:xml.php
示例6: txpXmlParser
function txpXmlParser()
{
$this->xml = xml_parser_create('UTF-8');
xml_parser_set_option($this->xml, XML_OPTION_CASE_FOLDING, 0);
xml_set_object($this->xml, $this);
xml_set_character_data_handler($this->xml, 'dataHandler');
xml_set_element_handler($this->xml, "startHandler", "endHandler");
xml_set_default_handler($this->xml, 'defaultHandler');
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:9,代码来源:txplib_xml.php
示例7: createParser
function createParser($filename)
{
$fh = fopen($filename, 'r');
$parser = xml_parser_create();
xml_set_element_handler($parser, "startElement", "endElement");
xml_set_character_data_handler($parser, "characterData");
xml_set_processing_instruction_handler($parser, "processingInstruction");
xml_set_default_handler($parser, "default");
return array($parser, $fh);
}
开发者ID:JohnWSteill,项目名称:EdProjs,代码行数:10,代码来源:11-8.php
示例8: soap_parser
function soap_parser($xml = '', $encoding = 'UTF-8')
{
global $soapTypes;
$this->soapTypes = $soapTypes;
$this->xml = $xml;
$this->xml_encoding = $encoding;
$this->root_struct = "";
// options: envelope,header,body,method
// determines where in the message we are (envelope,header,body,method)
$this->status = '';
$this->position = 0;
$this->pos_stat = 0;
$this->depth = 0;
$this->default_namespace = '';
$this->namespaces = array();
$this->message = array();
$this->fault = false;
$this->fault_code = '';
$this->fault_str = '';
$this->fault_detail = '';
$this->eval_str = '';
$this->depth_array = array();
$this->debug_flag = True;
$this->debug_str = '';
$this->previous_element = '';
$this->entities = array('&' => '&', '<' => '<', '>' => '>', "'" => ''', '"' => '"');
// Check whether content has been read.
if (!empty($xml)) {
$this->debug('Entering soap_parser()');
//$this->debug("DATA DUMP:\n\n$xml");
// Create an XML parser.
$this->parser = xml_parser_create($this->xml_encoding);
// Set the options for parsing the XML data.
//xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
// Set the object for the parser.
xml_set_object($this->parser, &$this);
// Set the element handlers for the parser.
xml_set_element_handler($this->parser, 'start_element', 'end_element');
xml_set_character_data_handler($this->parser, 'character_data');
xml_set_default_handler($this->parser, 'default_handler');
// Parse the XML file.
if (!xml_parse($this->parser, $xml, true)) {
// Display an error message.
$this->debug(sprintf("XML error on line %d: %s", xml_get_current_line_number($this->parser), xml_error_string(xml_get_error_code($this->parser))));
$this->fault = true;
} else {
// get final eval string
$this->eval_str = "\$response = " . trim($this->build_eval($this->root_struct)) . ";";
}
xml_parser_free($this->parser);
} else {
$this->debug("xml was empty, didn't parse!");
}
}
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:55,代码来源:class.soap_parser.inc.php
示例9: xml
function xml($encoding = "UTF-8")
{
$this->_parser = xml_parser_create($encoding);
$this->_xml_data = "";
$this->_actual_tag = $this;
xml_set_object($this->_parser, $this);
xml_parser_set_option($this->_parser, XML_OPTION_CASE_FOLDING, false);
xml_set_element_handler($this->_parser, "tag_open", "tag_close");
xml_set_character_data_handler($this->_parser, "tag_data");
xml_set_default_handler($this->_parser, "tag_data");
}
开发者ID:dzungnv02,项目名称:vspace,代码行数:11,代码来源:Xml.php
示例10: __construct
/**
* @since 2.0
*/
public function __construct()
{
$this->parser = xml_parser_create();
xml_parser_set_option($this->parser, XML_OPTION_SKIP_WHITE, 0);
xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
xml_set_object($this->parser, $this);
xml_set_element_handler($this->parser, 'handleOpenElement', 'handleCloseElement');
xml_set_character_data_handler($this->parser, 'handleCharacterData');
xml_set_default_handler($this->parser, 'handleDefault');
//xml_set_start_namespace_decl_handler($parser, 'handleNsDeclaration' );
}
开发者ID:ReachingOut,项目名称:SemanticMediaWiki,代码行数:15,代码来源:XmlResponseParser.php
示例11: __construct
/**
* Class constructor
*
* @param string The path of the file to parse
* @param string A prefix path to add to all 'src' and 'href' attributes, if relative
* @param string The output charset (default is UTF-8)
* @return void
*/
public function __construct($file, $charset = 'UTF-8')
{
// The charset must be uppercase
$charset = strtoupper($charset);
// Checks if the file exists
if (!file_exists($file) || !is_file($file)) {
// The file does not exist
throw new Woops_Xml_Parser_Exception('The specified XML file (\'' . $file . '\') does not exist', Woops_Xml_Parser_Exception::EXCEPTION_NO_FILE);
}
// Checks if the file is readable
if (!is_readable($file)) {
// Cannot read the file
throw new Woops_Xml_Parser_Exception('The specified XML file (\'' . $file . '\') is not readable', Woops_Xml_Parser_Exception::EXCEPTION_FILE_NOT_READABLE);
}
// Checks if the charset is supported
if (!isset(self::$_charsets[$charset])) {
// Unsupported charset
throw new Woops_Xml_Parser_Exception('The specified charset (' . $charset . ') is not supported', Woops_Xml_Parser_Exception::EXCEPTION_INVALID_CHARSET);
}
// Creates an XML parser
$this->_parser = xml_parser_create($charset);
// Sets the current instance as the XML parser object
xml_set_object($this->_parser, $this);
// Disables case-folding
xml_parser_set_option($this->_parser, XML_OPTION_CASE_FOLDING, false);
// Sets the element handler methods
xml_set_element_handler($this->_parser, '_startElementHandler', '_endElementHandler');
// Sets the character data handler method
xml_set_character_data_handler($this->_parser, '_characterDataHandler');
// Sets the processing instruction handler method
xml_set_processing_instruction_handler($this->_parser, '_processingInstructionHandler');
// Sets the default data handler method
xml_set_default_handler($this->_parser, '_defaultHandler');
// Tries to open a file handler
if ($fileHandler = fopen($file, 'r')) {
// Reads data from the file
while ($data = fread($fileHandler, 4096)) {
// Tries to parse the data
if (!xml_parse($this->_parser, $data, feof($fileHandler))) {
// Gets the error string and line number
$errorString = xml_error_string(xml_get_error_code($this->_parser));
$errorLine = xml_get_current_line_number($this->_parser);
// Throws an exception, as we have an XML error
throw new Woops_Xml_Parser_Exception('XML parser error: ' . $errorString . ' at line number ' . $errorLine, Woops_Xml_Parser_Exception::EXCEPTION_XML_PARSER_ERROR);
}
}
// Closes the file handler
fclose($fileHandler);
}
// Frees the parser
xml_parser_free($this->_parser);
}
开发者ID:Sect0R,项目名称:WOOPS,代码行数:60,代码来源:Parser.class.php
示例12: SaxParser
function SaxParser(&$input)
{
$this->level = 0;
$this->parser = xml_parser_create('UTF-8');
xml_set_object($this->parser, $this);
$this->input =& $input;
$this->setCaseFolding(false);
$this->useUtfEncoding();
xml_set_element_handler($this->parser, 'handleBeginElement', 'handleEndElement');
xml_set_character_data_handler($this->parser, 'handleCharacterData');
xml_set_processing_instruction_handler($this->parser, 'handleProcessingInstruction');
xml_set_default_handler($this->parser, 'handleDefault');
xml_set_unparsed_entity_decl_handler($this->parser, 'handleUnparsedEntityDecl');
xml_set_notation_decl_handler($this->parser, 'handleNotationDecl');
xml_set_external_entity_ref_handler($this->parser, 'handleExternalEntityRef');
}
开发者ID:BackupTheBerlios,项目名称:soopa,代码行数:16,代码来源:saxparser.php
示例13: parse
function parse($xml)
{
$this->node_list = array(0 => array('type' => 'start', 'children' => array()));
$this->cur_nodeid = 0;
$this->parser = xml_parser_create();
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($this->parser, XML_OPTION_SKIP_WHITE, 1);
xml_set_element_handler($this->parser, array(&$this, 'handle_element_open'), array(&$this, 'handle_element_close'));
xml_set_character_data_handler($this->parser, array(&$this, 'handle_cdata'));
xml_set_processing_instruction_handler($this->parser, array(&$this, 'handle_instruction'));
xml_set_default_handler($this->parser, array(&$this, 'handle_default'));
xml_parse($this->parser, $xml, true);
xml_parser_free($this->parser);
$this->parser = null;
return $this->node_list;
}
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:16,代码来源:class_xml_dom.php
示例14: showXML
function showXML($data, $display)
{
if ($display) {
for ($i = 0; $i < $postVars[numHosts]; $i++) {
$xml_parser = xml_parser_create();
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 1);
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
xml_set_default_handler($xml_parser, "defaultHandler");
echo "<pre>";
if (!xml_parse($xml_parser, $data[$i])) {
die(sprintf("XML error: %s at line %d\n", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser)));
}
echo "</pre>";
xml_parser_free($xml_parser);
}
}
}
开发者ID:Giordano-Bruno,项目名称:GiordanoBruno,代码行数:18,代码来源:lookupSruFunc.php
示例15: makeResultFromXml
/**
* Parse the given XML result and return an SMWSparqlResultWrapper for
* the contained data.
*
* @param $xmlQueryResult string
*/
public function makeResultFromXml($xmlQueryResult)
{
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0);
xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_set_object($parser, $this);
xml_set_element_handler($parser, 'xmlHandleOpen', 'xmlHandleClose');
xml_set_character_data_handler($parser, 'xmlHandleCData');
xml_set_default_handler($parser, 'xmlHandleDefault');
//xml_set_start_namespace_decl_handler($parser, 'xmlHandleNsDeclaration' );
$this->m_xml_opentags = array();
$this->m_header = array();
$this->m_data = array();
$this->m_comments = array();
xml_parse($parser, $xmlQueryResult, true);
xml_parser_free($parser);
return new SMWSparqlResultWrapper($this->m_header, $this->m_data, $this->m_comments);
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:25,代码来源:SMW_SparqlResultParser.php
示例16: parse
protected function parse($xmlData)
{
$this->parser = xml_parser_create();
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, false);
xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, "ISO-8859-1");
xml_set_object($this->parser, $this);
xml_set_element_handler($this->parser, 'onTagStart', 'onTagEnd');
xml_set_character_data_handler($this->parser, 'onTagContent');
xml_set_processing_instruction_handler($this->parser, "onPiHandler");
xml_set_default_handler($this->parser, "onDefaultHandler");
if (!xml_parse($this->parser, $xmlData)) {
$xmlErroCode = xml_get_error_code($this->parser);
$xmlErroString = xml_error_string($xmlErroCode);
$xmlLine = xml_get_current_line_number($this->parser);
die(sprintf("XML error: %s at line %d", $xmlErroString, $xmlLine));
}
xml_parser_free($this->parser);
$this->parser = NULL;
}
开发者ID:kelsoncm,项目名称:phpage,代码行数:19,代码来源:Sax.php
示例17: init
protected final function init()
{
if ($this instanceof Features\IXmlNamespaceParser) {
$this->parser = xml_parser_create_ns('UTF-8');
// Set up start namespace declaration handler
xml_set_start_namespace_decl_handler($this->parser, 'ns_start');
// Set up end namespace declaration handler
xml_set_end_namespace_decl_handler($this->parser, 'ns_end');
} elseif ($this instanceof Features\IXmlBasicParser) {
$this->parser = xml_parser_create('UTF-8');
} else {
throw new \BadMethodCallException('This class does not implements the XML Parser capabilities. Please implement either IXmlBasicParser or IXmlNamespaceParser.');
}
xml_set_object($this->parser, $this);
foreach ($this->options as $option => $value) {
xml_parser_set_option($this->parser, $option, $value);
}
if ($this instanceof Features\IXmlProcessorParser) {
// Set up processing instruction (PI) handler
xml_set_processing_instruction_handler($this->parser, 'pi_handler');
}
if ($this instanceof Features\IXmlEntityHandler) {
// Set up external entity reference handler
xml_set_external_entity_ref_handler($this->parser, 'entity_handler');
}
if ($this instanceof Features\IXmlNdataHandler) {
// Set up notation declaration handler
xml_set_notation_decl_handler($this->parser, 'notation_handler');
// Set up unparsed entity declaration handler
xml_set_unparsed_entity_decl_handler($this->parser, 'ndata_handler');
}
xml_set_element_handler($this->parser, "element_start", "element_end");
xml_set_character_data_handler($this->parser, "cdata_handler");
if ($this instanceof Features\IXmlDefaultHandler) {
if (!defined('ACTIVATE_XML_PARSER_DEFAULT_HANDLER_I_KNOW_WHAT_AM_I_DOING')) {
trigger_error('Active default handler interferes with many XML features like internal parsable entities.', E_USER_WARNING);
}
// Set up default (fallback) handler.
// Warning: Interferes with INTERNAL ENTITY declarations like
// <!ENTITY a 'b'>
xml_set_default_handler($this->parser, "default_handler");
}
}
开发者ID:anrdaemon,项目名称:library,代码行数:43,代码来源:XmlParser.php
示例18: __construct
/**
* Constructor.
*
* @param String $configFile
* The path of the config file
*/
public function __construct($configFile)
{
// If the path is a valid file we use it as is
if (is_file($configFile)) {
$this->file = $configFile;
} else {
// Otherwise we look in the config directory
$this->file = PHPCHECKSTYLE_HOME_DIR . "/config/" . $configFile;
if (!is_file($this->file)) {
echo "Config file not found : " . $configFile;
exit(0);
}
}
$this->xmlParser = xml_parser_create();
xml_set_object($this->xmlParser, $this);
xml_set_element_handler($this->xmlParser, "_startElement", "_endElement");
xml_set_character_data_handler($this->xmlParser, "_gotCdata");
xml_set_default_handler($this->xmlParser, "_gotCdata");
}
开发者ID:cxzhp,项目名称:phpcheckstyle_without_namespace,代码行数:25,代码来源:CheckXMLStyleConfig.php
示例19: import
/**
* Import HTML from $source to $target node.
*
* @param \DOMElement $source
* @param \DOMElement $target
*
* @since 1.0
*/
public static function import(\DOMElement $source, \DOMElement $target)
{
/* Prepare container */
$container = $target->ownerDocument->createElement('xhtml:div');
$container->setAttributeNS(Atom::XMLNS, 'xmlns:xhtml', Atom::XHTML);
$target->appendChild($container);
/* Prefix all source tags with "xhtml:" */
$xmlFrom = $source->ownerDocument->saveXML($source);
$xmlTo = '';
$xhtmlNsSet = false;
$parser = xml_parser_create('UTF-8');
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_set_element_handler($parser, function ($parser, $name, array $attrs) use($xmlFrom, &$xmlTo, &$xhtmlNsSet) {
$selfClosing = '/>' === substr($xmlFrom, xml_get_current_byte_index($parser), 2);
$xmlTo .= '<xhtml:' . $name;
if (false === $xhtmlNsSet) {
$attrs['xmlns:xhtml'] = Atom::XHTML;
$xhtmlNsSet = true;
}
foreach ($attrs as $attr => $value) {
$xmlTo .= sprintf(' %s="%s"', $attr, htmlspecialchars($value, ENT_COMPAT | ENT_XML1));
}
$xmlTo .= $selfClosing ? '/>' : '>';
}, function ($parser, $name) use($xmlFrom, &$xmlTo) {
$selfClosing = '/>' === substr($xmlFrom, xml_get_current_byte_index($parser) - 2, 2);
if ($selfClosing) {
return;
}
$xmlTo .= '</xhtml:' . $name . '>';
});
xml_set_default_handler($parser, function ($parser, $data) use(&$xmlTo) {
$xmlTo .= $data;
});
xml_parse($parser, $xmlFrom, true);
xml_parser_free($parser);
/* Import prefixed XML into container */
$tmpDoc = new \DOMDocument('1.0', 'utf-8');
$tmpDoc->loadXML($xmlTo);
foreach ($tmpDoc->documentElement->childNodes as $node) {
$container->appendChild($container->ownerDocument->importNode($node, true));
}
}
开发者ID:mekras,项目名称:atom,代码行数:50,代码来源:Xhtml.php
示例20: runtest
function runtest($num, $i)
{
$this->readfile($num);
echo "parsing xml data file {$this->currentFile} iteration {$i}\n";
$xml_parser = xml_parser_create();
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 1);
xml_set_object($xml_parser, $this);
xml_set_element_handler($xml_parser, 'startElement', 'endElement');
xml_set_character_data_handler($xml_parser, 'cDataHandler');
xml_set_external_entity_ref_handler($xml_parser, 'externalEntityRefHandler');
xml_set_processing_instruction_handler($xml_parser, 'piHandler');
xml_set_unparsed_entity_decl_handler($xml_parser, 'unparsedEntityDeclHandler');
xml_set_notation_decl_handler($xml_parser, 'entityDeclHandler');
xml_set_default_handler($xml_parser, 'defaultHandler');
if (!xml_parse($xml_parser, $this->contentBuffer, true)) {
$this->currentFile != '' ? $inFile = "in file {$this->currentFile}" : ($inFile = '');
$this->fatalErrorPage(sprintf(get_class($this) . ": XML error: %s at line %d {$inFile}", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser)));
}
xml_parser_free($xml_parser);
}
开发者ID:michaelprem,项目名称:phc,代码行数:20,代码来源:xmlparse.php
注:本文中的xml_set_default_handler函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论