<jupyter_start><jupyter_text>xml analysis  setup<jupyter_code>from lxml import etree
etree
fp=r'EPC Redacted.xml'<jupyter_output><empty_output><jupyter_text>parse xml<jupyter_code>xml=etree.parse(fp)
xml
root=xml.getroot()
root<jupyter_output><empty_output><jupyter_text>find elements<jupyter_code>e=root.xpath('.//rdsap:Main-Heating-Index-Number',namespaces={'rdsap':'http://www.epcregister.com/xsd/rdsap'})
e=e[0]
e.text
e=root.xpath('.//rdsap:Heat-Loss-Perimeter',namespaces={'rdsap':'http://www.epcregister.com/xsd/rdsap'})[0]
e.attrib
e.get('quantity')
e=root.xpath('.//rdsap:*[@quantity]',namespaces={'rdsap':'http://www.epcregister.com/xsd/rdsap'})
e<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19941775836972345, 'fraction_numerical': 0.002911208151382824, 'mean_word_length': 9.920634920634921, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 3, 'xml': 7}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '464556', 'license': 'MIT', 'n_tokens_mistral': 312, 'n_tokens_neox': 303, 'n_words': 21, 'path': 'xml_analysis/xml_analysis.ipynb', 'repo_name': 'stevenkfirth/DataAnalysisTest', 'size': '687'}