<jupyter_start><jupyter_text>Import the documentation from buildingsmart<jupyter_code>import urllib3
import shutil
http = urllib3.PoolManager()
path = "./2x3_TC1_entities.htm"

url = "https://standards.buildingsmart.org/IFC/RELEASE/IFC2x3/TC1/HTML/alphabeticalorder_entities.htm"

with http.request('GET', url, preload_content=False) as r, open(path, 'wb') as out_file:       
    shutil.copyfileobj(r, out_file)<jupyter_output><empty_output><jupyter_text>parse the data<jupyter_code>!pip install lxml
import lxml.html
import lxml.etree
toc = lxml.html.parse(path).getroot()
hrefs  = toc.findall(".//a[@href]")
hrefs[0].get("href")

lookup = {href.get("href").split("/")[-1].split(".")[0]:href for href in hrefs}
schema = ifcopenshell.ifcopenshell_wrapper.schema_by_name("IFC2X3")

import ifcopenshell
schema = ifcopenshell.ifcopenshell_wrapper.schema_by_name("IFC2X3")
decls = schema.declarations()
base_url3 = "https://standards.buildingsmart.org/IFC/RELEASE/IFC2x3/TC1/HTML/"
doc_urls = {declname.name_lc() : base_url3 + lookup.get(declname.name_lc(),{}).get("href","") for declname in decls}
print("<a href='"+doc_urls.get("ifcdoor")+"'>doc</a>")
import json
with open("ifc2x3doc.json", "w+") as f:
    json.dump(doc_urls, f)
import webbrowser
webbrowser.open(doc_urls.get("ifcwindow"))
from IPython.display import Javascript

def window_open(url):
    display(Javascript('window.open("{url}");'.format(url=url)))
window_open(doc_urls.get("ifcdoor"))
from IPython.display import Javascript

def window_open(url):
    display(Javascript('window.open("{url}");'.format(url=url)))
#https://github.com/jupyterlab/jupyterlab/issues/6235#issuecomment-485902842 
# call external webpage into iframe
from IPython.display import IFrame
IFrame(src=doc_urls.get("ifcwindow"), width='100%', height='500px')
import xml.etree.ElementTree as et
et.parse('./add2.htm').getroot()

et.parse ("https://standards.buildingsmart.org/IFC/RELEASE/IFC4/ADD2_TC1/HTML/toc.htm")
et.parse()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16633266533066132, 'fraction_numerical': 0.022545090180360723, 'mean_word_length': 6.862204724409449, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 5}, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '532347', 'license': 'MIT', 'n_tokens_mistral': 784, 'n_tokens_neox': 761, 'n_words': 113, 'path': 'utils/createDOC.ipynb', 'repo_name': 'jakob-beetz/ifcopenshell-notebooks', 'size': '1996'}