https://github.com/sandcore-dev/xml-analyzer
Analyze XML strings or files to determine the type of attributes and text nodes.
https://github.com/sandcore-dev/xml-analyzer
php xml
Last synced: 8 months ago
JSON representation
Analyze XML strings or files to determine the type of attributes and text nodes.
- Host: GitHub
- URL: https://github.com/sandcore-dev/xml-analyzer
- Owner: sandcore-dev
- Created: 2021-02-02T20:08:29.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-02-22T20:27:20.000Z (over 5 years ago)
- Last Synced: 2025-03-16T06:17:18.351Z (about 1 year ago)
- Topics: php, xml
- Language: PHP
- Homepage:
- Size: 41 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# XML Analyzer
Analyze one or more XML strings or files to guess the type and thus the range of values of attributes and node values.
## Examples
```php
$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();
```