natlibfi/finna-xml
最新稳定版本:1.0.1
Composer 安装命令:
composer require natlibfi/finna-xml
包简介
Yet another XML parser, reader and writer for diverse records with and without namespaces.
README 文档
README
Introduction
Finna-XML is yet another XML handling library for PHP. It's based on PHP's XMLReader and XMLWriter. The resulting array format is inspired by sabre-xml.
The main goals for the library are:
- To make it easy to extract information from repeated XML elements.
- To make it easy to manage multiple namespaces and records that are missing namespace definitions.
- To do things quickly for a large number of XML records. Data structure is just a collection of associative arrays avoiding overhead of working with objects (though it makes some things more cumbersome).
- To make it possible to serialize and unserialize the parsed array without loss of information.
Features
- Parse XML regardless of namespaces.
- Find contents in XML easily even when using multiple namespace.
- Render the XML as string (simple cases also with namespace added where missing).
- Serialize/unserialize the parsed structure for caching or other re-use.
Installation
The recommended method for incorporating this library into your project is to use Composer (http://getcomposer.org):
composer require natlibfi/finna-xml
Usage
All queries for the document contents are done with paths. Even immediate children of a node can be retrieved with a path. While the path queries resemble XPath, Finna-XML does not support any actual XPath features. All queries are relative to the starting node (or root node, if omitted), and there is currently no support for attribute filtering etc. This allows the queries to be as quick as possible.
If you need proper XPath support, use something else. :)
The following notations are supported for searching element and attribute names:
Clark notation: {namespace-uri}localName
This notation is used internally and required when there are namespaces in multi-level path queries.
Space notation: namespace-url localName
This notation can be used for a single-level path query.
Examples
See the examples directory for actual examples.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-08