xml_class来自 phpcms
<?php
class xml{
var $parser;
var $document;
var $stack;
var $data;
var $last_opened_tag;
var $isnormal;
var $attrs=array();
var $failed=false;
function __construct($isnormal){
$this->XMLparse($isnormal);
}
function XMLparse($isnormal){
$this->isnormal=$isnormal;
$this->parser=xml_parser_create('ISO-8859-1');
xml_parser_set_option($this->parser,XML_OPTION_CASE_FOLDING,false);
xml_set_object($this->parser,$this);
xml_set_element_handler($this->parser,'open','close');
xml_set_character_data_handler($this->parser,'data');
}
function destruct(){
xml_parser_free($this->parser);
}
function parse(&$data){
$this->document=array();
$this->stack=array();
return xml_parse($this->parser,$data,true)&&!$this->failed?$this->document:'';
}
function open(&$parser,$tag,$attributes){
$this->data='';
$this->failed=false;
if(!$this->isnormal){
if(isset($attributes['id'])&&!is_string($this->document[$attributes['id']])){
$this->document=&$this->document[$attributes['id']];
}else{
$this->failed=true;
}
}else{
if(!isset($this->document[$tag])||!is_string($this->document[$tag])){
$this->document=&$this->document[$tag];
}else{
$this->failed=true;
}
}
$this->stack[]=&$this->document;
$this->last_opened_tag=$tag;
$this->attrs=$attributes;
}
function data(&$parser,$data){
if($this->last_opened_tag!=null){
$this->data.=$data;
}
}
function close(&$parser,$tag){
if($this->last_opened_tag==$tag){
$this->document=$this->data;
$this->last_opened_tag=null;
}
array_pop($this->stack);
if($this->stack){
$this->document=&$this->stack[count($this->stack)-1];
}
}
}
?>
xml_class来自 phpcms的更多相关文章
- php Zend Opcache,xcache,eAccelerator缓存优化详解及对比
XCACHE XCache 是一个开源的 opcode 缓存器/优化器, 这意味着他能够提高您服务器上的 PHP 性能. 他通过把编译 PHP 后的数据缓冲到共享内存从而避免重复的编译过程, 能够直接 ...
- 使用strace查看C语言级别的php源码
XCACHE XCache 是一个开源的 opcode 缓存器/优化器, 这意味着他能够提高您服务器上的 PHP 性能. 他通过把编译 PHP 后的数据缓冲到共享内存从而避免重复的编译过程, 能够直接 ...
- phpcms V9 内容模型管理
[1]理解模型 模型,系统知识的抽象表示.既然抽象了,那就得脑补一下.大家都是面向对象设计的专业人员,类就很抽象的,对比类的定义想象一下模型的概念. 举个例子,一般新闻类的信息,都具有标题.内容.作者 ...
- phpcms万能字段如何使用php方法
来自:http://www.tantengvip.com/2013/12/phpcms-php-function/ phpcms后台内容模块->模型管理->添加字段功能很强大,你只需在ph ...
- 【转】phpcms授课学习
来自:http://blog.csdn.net/yanhui_wei/article/category/1220735 <?php 思路: 一.目前在企业中使用比较多的cms内容管理有如下几种: ...
- phpcms后台部分修改
1.后台登陆前提示信息取消及成功后提示信息取消. (1)后台登陆前提示信息取消 phpcms\modules\admin\classes\admin.class.ph ...
- phpcms V9 内容模型管理(转)
转自:http://www.cnblogs.com/Braveliu/p/5102627.html [1]理解模型 模型,系统知识的抽象表示.既然抽象了,那就得脑补一下.大家都是面向对象设计的专业人员 ...
- PHPCMS v9 模型概念及用法
phpcms v9 模型概念 一.什么是模型? 模型是系统知识的抽象表示.我们不能仅仅通过语言来描述一个系统,也不能仅仅通过记忆来记录关于系统的知识.知识是通过某种媒介来表达的,这种媒介所表达的内容就 ...
- 搜查的PHPCMS,织梦DEDECMS 部分对比分析
对于初学者来说,我想会有相对的了解和认识,自然也有助于今后前端面试的一些小细节!当下学的自然是phpcms phpcms优点: 1. 模块化安装,非常适合安装,拆卸非常方便的. 2. 灵活的标签语法, ...
随机推荐
- UML-活动图及其建模
1.目标:UML活动图标示法. 2.定义:一个UML活动图标示一个过程中的多个顺序活动和并行活动.这些活动有助于对业务过程.工作流.数据流和复杂算法进行建模. 3.作用:既能表示控制流又能标示数据流. ...
- Maven--Cargo远程部署
参考:https://www.digitalocean.com/community/questions/how-to-access-tomcat-8-admin-gui-from-different- ...
- Node.js—第一个动态页面
话不多说 上代码 没有加什么处理也不严谨 只为效果 const http=require('http'), path=require('path'), fs=require('fs') //创建服务 ...
- ICRA 2019最佳论文公布 李飞飞组的研究《Making Sense of Vision and Touch: Self-Supervised Learning of Multimodal Representations for Contact-Rich Tasks》获得了最佳论文
机器人领域顶级会议 ICRA 2019 正在加拿大蒙特利尔举行(当地时间 5 月 20 日-24 日),刚刚大会公布了最佳论文奖项,来自斯坦福大学李飞飞组的研究<Making Sense of ...
- 操作uwsgi命令
uwsgi -i 你的目录/uwsgi.ini & 后台开启uwsgi pkill -f uwsgi 重启uwsgi
- 跨站脚本(XSS)攻击
https://blog.csdn.net/extremebingo/article/details/81176394
- cin cout
编写一个程序,要求用户输入一串整数和任意数目的空格,这些整数必须位于同一行中,但允许出现在该行的任何位置.当用户按下enter键,数据输入停止.程序自动对所有的整数进行求和并打印出结果. 需要解决两个 ...
- WEB网站的favicon.ico的设置
一.什么是favicon.ico Favicon是Favorites Icon的缩写,favicon.ico是指显示在浏览器收藏夹和地址栏网站网址前面的个性化图标,常被成为网页小图标.网站缩略图标或者 ...
- pip anaconda 添加国内镜像
源地址 官方默认镜像太慢.换成国内源比较快.几个源的地址: 清华:https://pypi.tuna.tsinghua.edu.cn/simple 阿里云:http://mirrors.aliyun. ...
- saturates|meteoric|enclose|marooned|predators|Pioneer community|salinization|condenser|embodied
saturates渗透 meteoric蒸汽 enclose包围 Pioneer community 先锋群落 Climax community顶级群落 cumulative积累 Rebound 回弹 ...