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. 灵活的标签语法, ...
随机推荐
- tomcat用户配置
1.tomcat-user.xml 添加以下内容<role rolename="manager-gui"/> <role rolename="manag ...
- 加速软件源更新和安装 ubuntu 软件中心
Linux mint 12 修改加速软件源更新和安装 ubuntu 软件中心 由于 linux mint 12 是基于 ubuntu 的,可以使用 ubuntu 的源(Ubuntu 11.10 代号 ...
- Java自学-泛型 泛型转型
Java 中的子类泛型转型成父类泛型 步骤 1 : 对象转型 根据面向对象学习的知识,子类转父类 是一定可以成功的 package generic; import charactor.ADHero; ...
- share团队冲刺5
团队冲刺第五天 昨天:按钮操作,自定义按钮及各种原件样式 今天:设置按钮按下效果,界面布局 问题:无
- 为什么Web前端变的越来越复杂,变得更加难学了
前端发展了也有些年头了,曾记得很多年前,聊起前端,都觉得是很简单,那个时候都没有前端工程师这个职位.可现在,前端已经逆袭了,已经不是原来的样子了,各种技术层出不穷,显的越来越高深莫测了.前端真的变得那 ...
- JunOS SRX firewal Web authentication(转)
转载自:https://srxasa.wordpress.com/2011/12/11/junos-srx-firewal-web-authentication/ JunOS SRX firewal ...
- 吴裕雄--天生自然TensorFlow2教程:numpy [ ] 索引
import tensorflow as tf a = tf.ones([1, 5, 5, 3]) a.shape a[0][0] numpy : 索引 a = tf.random.normal([4 ...
- springboot配置多个yml文件
新接触了springboot项目,yml一大堆,启动不知道用的哪个,各种百度后: <profiles> <profile> <id>dev</id> & ...
- Spire.doc jar包实现word文件添加水印demo
/** * @create: 2020-02-23 21:50 */ import com.spire.doc.*; import com.spire.doc.documents.WatermarkL ...
- JdbcRDD连接MySQL
(1)添加依赖 <dependencies> <dependency> <groupId>org.apache.spark</groupId> < ...