Analyse the structure of an arbitrary XML file
Project description
xml-analyser
A tool showing various statistics about element usage in an arbitrary XML file.
Usage:
xml-analyser example.xml
If example.xml
looks like this:
<example>
<foo>
<bar a="1" b="2">
<baz>This has text</baz>
</bar>
</foo>
<foo>
<bar a="1" b="2" c="3">
<baz>More text here</baz>
</bar>
<baz d="1" />
</foo>
</example>
xml-analyzer example.xml
outputs this:
{
"example": {
"count": 1,
"parent_counts": {},
"attr_counts": {},
"child_counts": {
"foo": 2
}
},
"foo": {
"count": 2,
"parent_counts": {
"example": 2
},
"attr_counts": {},
"child_counts": {
"bar": 2,
"baz": 1
}
},
"bar": {
"count": 2,
"parent_counts": {
"foo": 2
},
"attr_counts": {
"a": 2,
"b": 2,
"c": 1
},
"child_counts": {
"baz": 2
}
},
"baz": {
"count": 3,
"parent_counts": {
"bar": 2,
"foo": 1
},
"attr_counts": {
"d": 1
},
"child_counts": {},
"count_with_text": 2,
"max_text_length": 14
}
}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
xml-analyser-1.1.tar.gz
(7.0 kB
view hashes)
Built Distribution
Close
Hashes for xml_analyser-1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eea951365130027bec66b380a32a48275b5ab082dfcb3a9c4348510e68038468 |
|
MD5 | 2d57ce0406c30983c5e296dcae8d0e1d |
|
BLAKE2b-256 | 25bcc569347330269b6fba2d8ed3a04fbfa271c6fba7a8ed8a1953330c95a7a7 |