PHP Класс Microweber\Utils\lib\XmlStreamer

Copyright (c) 2014 Oskar Thornblad ([email protected]), contributions from Valiton GmbH, Michael Härtl https://github.com/prewk/XmlStreamer Licensed under MIT: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Показать файл Открыть проект

Открытые методы

Метод Описание
__construct ( $mixed, $chunkSize = 16384, $customRootNode = null, $totalBytes = null, $customChildNode = null )
chunkCompleted ( ) Called after a chunk was completed. Useful to chunk INSERT data into DB.
getReadBytes ( ) Gets the total read bytes so far.
getTotalBytes ( ) Gets the total file size of the xml.
init ( ) Called after the constructor completed setup of the class. Can be overriden in a child class.
parse ( ) Starts the streaming and parsing of the XML file.
processNode ( $xmlString, $elementName, $nodeIndex ) : If Gets called for every XML node that is found as a child to the root node.

Приватные методы

Метод Описание
readNextChunk ( )

Описание методов

__construct() публичный Метод

public __construct ( $mixed, $chunkSize = 16384, $customRootNode = null, $totalBytes = null, $customChildNode = null )
$mixed Path to XML file OR file handle
$chunkSize Bytes to read per cycle (Optional, default is 16 KiB)
$customRootNode Specific root node to use (Optional)
$totalBytes Xml file size - Required if supplied file handle

chunkCompleted() публичный Метод

Called after a chunk was completed. Useful to chunk INSERT data into DB.
public chunkCompleted ( )

getReadBytes() публичный Метод

Gets the total read bytes so far.
public getReadBytes ( )

getTotalBytes() публичный Метод

Gets the total file size of the xml.
public getTotalBytes ( )

init() публичный Метод

Called after the constructor completed setup of the class. Can be overriden in a child class.
public init ( )

parse() публичный Метод

Starts the streaming and parsing of the XML file.
public parse ( )

processNode() абстрактный публичный Метод

Gets called for every XML node that is found as a child to the root node.
abstract public processNode ( $xmlString, $elementName, $nodeIndex ) : If
$xmlString Complete XML tree of the node as a string
$elementName Name of the node for easy access
$nodeIndex Zero-based index that increments for every node
Результат If false is returned, the streaming will stop