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. 灵活的标签语法, ...
随机推荐
- iview checkbox demo(文档改写)
<template> <div class="content"> <div style="border-bottom: 1px solid ...
- Coursera机器学习——Recommender System测验
第一题本应该是基础题,考察Cost Function不同形式的表示方法,但却难住了我,说明基本概念掌握不够到位. 1. 在求和的部分,有两种可能,一种是(i,j)同时求和,即∑(i,j):r(i,j) ...
- tomcat配置配置文件和war包进行分离
应用部署 war包.配置文件分离 部署主机路径规划以及tomcat中间件改造 1.新建存放war包路径 /appsystems/apps 将war包放置其中 2.新建存放配置文件路径 /apps ...
- 卡常的编译命令(含O2优化)
不解释,直接来 //包括O2,O3之类的编译命令 //直接copy and paste #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma ...
- 第04项目:淘淘商城(SpringMVC+Spring+Mybatis) 的学习实践总结【第一天】
本人做过一年的MATLAB编程和简单维护过VB和C++的项目.是跟着网上获得的黑马的Java双元视频课来自学入门Java知识和常用框架的使用. 淘淘商城(SpringMVC+Spring+Mybati ...
- ElasticSearch-The number of object passed must be even but was [1]-问题解决
ES版本:6.4.3 1.The number of object passed must be even but was [1] 问题代码: IndexRequest indexRequest = ...
- python格式化输出的三种形式
法一: list_a = [1, 2, 3] str_b = 'aaa' string = "There are two contents:%s, %s" % (list_a, s ...
- Java常用面试题总结
1.多线程实现方式 2.cookie和session区别 3.数据加密 4.接口并发 5.常用的集合类 6.遍历集合方式 7.接口和抽象类 8.#和$区别 9.防止sql注入 10.springMvc ...
- 【按位dp】1出现的次数
l-r1出现的次数 注意端点处理 垃圾算法书 垃圾代码毁我青春 自己研究写了写 #include <iostream> #include <string> #include & ...
- ILSVRC2012下载
http://www.image-net.org/challenges/LSVRC/2012/nnoupb/ILSVRC2012_img_test.tarhttp://www.image-net.or ...