sandcore-dev/xml-analyzer

Analyze XML files to guess the range of values of attributes and text nodes

0.2.1 2021-02-16 21:23 UTC

This package is auto-updated.

Last update: 2024-09-23 04:54:43 UTC


README

Analyze one or more XML strings or files to guess the type and thus the range of values of attributes and node values.

Examples

$analyzer = new \SandcoreDev\XmlAnalyzer\XmlAnalyzer();

// Analyze one or more XML strings. More data is more accurate. 
$result = $analyzer->process($xmlString, $anotherXmlString, ...$moreXmlStrings);

// Analyze one or more XML files. More data is more accurate.
$result = $analyzer->processFile($xmlFile, $anotherXmlFile, ...$moreXmlFiles);

// Available types are in src/Types/
$result->getType();

$result->getAttributes();
$result->getAttribute('foo');

$result->getChildren();
$child = $result->getChild('bar');

// Each (child) node has the same methods available
$child->getType();
$child->getAttributes();
$child->getChildren();