bitandblack/xmlprocessor 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bitandblack/xmlprocessor

Composer 安装命令:

composer require bitandblack/xmlprocessor

包简介

Fastest handling of huge XML data.

README 文档

README

PHP from Packagist Codacy Badge Latest Stable Version Total Downloads License

XMLProcessor

Fastest handling of huge XML data.

The Bit&Black XML Processor is up to 20 times faster in parsing huge xml data. This is because it doesn't make use of foreach to handle XML nodes. Instead, the processor uses a while loop and a copy of the DOMElements.

Installation

This library is made for the use with Composer. Add it to your project by running $ composer require bitandblack/xmlprocessor.

Usage

Set up the processor with your xml data:

<?php

use DOMDocument;
use BitAndBlack\XML\XMLProcessor;

$domDocument = new DOMDocument();
$domDocument->load('your_huge_file.xml');

$xmlProcessor = new XMLProcessor($domDocument);

Use eachElement() now instead of foreach:

<?php

//$nodes = $domDocument->getElementsByTagName('some_node'):
//
//foreach ($nodes as $key => $node) {
//    var_dump('Found at position ' . $key . ' node with id ' . $node->getAttribute('id'));
//}

$xmlProcessor->eachElement(
    static function(DOMDocument $domDocument) {
        return $domDocument->getElementsByTagName('some_node');
    },
    static function(DOMNode $node, int $key) {
        var_dump('Found at position ' . $key . ' node with id ' . $node->getAttribute('id'));
    }
);

The first attribute is a function where you can set up the statement with whom you can select the nodes you want to.

The second attribute is a callback function which is called for every processed item.

eachElement() makes a clone of the DOM to reach a fast processing so modifying the original DOM at the same time will not target the processed data.

Help

If you have questions feel free to contact us under hello@bitandblack.com.

Further information about Bit&Black can be found under www.bitandblack.com.

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-12-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固