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. 灵活的标签语法, ...
随机推荐
- Vue.js——4.指令 笔记
v-cloak:解决网速延迟 闪烁问题v-text=msg: 和{{}}表达式一样,没有闪烁问题,但是前后不能加别的,覆盖原本的内容 innerTextv-html=msg:innerHtml,一样可 ...
- 18 11 07 pygame 继续使用
---恢复内容开始--- 1 给原来的游戏不定时 增加一些敌机 用到了pygame的定时器 定时器就是每隔一段时间 就进行一次相同的操作 2 pyagame 在捕获键盘操作有两种 1 ...
- Dynamics CRM - 不同类型字段在 Plugin 里的赋值方式
在编写 Plugin 代码之前,我们可以需要用 SDK bin 目录下的 CrmSvcUtil.exe 来将 CRM Site 上所有的 Entity 转换成类,而 Entity 里的 Field 也 ...
- html_js_jq_css
// ----- JQ $(function(){$(div').bind('mouseout mouseover', function () {// 移入和移出分别执行一次alert('bind 可 ...
- java IO流的概念与分类
DataInputStream && ObjectInputStream 示例 https://blog.csdn.net/hoho_12/article/details/520543 ...
- MySQL-SQL语句分类
MySQL中的SQL语句有:DDL,DML,DCL,DQL,TCL DDL:数据库定义语言 data Definition language 用于创建.修改.和删除数据库内的数据结构,如: 1:创建和 ...
- Android自定义的弹窗
package com.microduino.qoobot.view; import android.app.Activity; import android.app.Dialog; import a ...
- fscanf的用法
fscanf用于读取字符串数据流,遇到空白字符(空格' '; 制表符'\t'; 新行符'\n')就停止,若要读取完整的一行数据,可以使用格式控制("%[^\n]%*c"),或者使用 ...
- 推荐:MongoDB学习资料
http://www.mongodb.org/display/DOCS/Production+Deployments Official MongoDBProject Website Getting S ...
- 解决DIV超出样式长度自动换行
width: 100px;display:block;word-break: break-all;word-wrap: break-word;