Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Reads and parses construction XML formats such as P6 schedules, BSDD exports, IFC-XML and COBie-XML into pandas DataFrames.
Use this skill ↓30% 52%+22 ptsof test cases passed
Passed 12 of 23 test cases with the skill, and 7 of 23 without it.
3 of 3 safety checks passed
Not used yet
XML is used in construction for P6 schedules (XER), IFC-XML, COBie-XML, and buildingSMART Data Dictionary exports. This skill parses XML and converts to structured DataFrames.
import xml.etree.ElementTree as ET
import pandas as pd
from typing import Dict, Any, List, Optional, Union
from dataclasses import dataclass
from pathlib import Path
import re
@dataclass
class XMLElement:
"""Parsed XML element."""
tag: str
attributes: Dict[str, str]
text: Optional[str]
children: List['XMLElement']
class ConstructionXMLReader:
"""Parse XML from construction systems."""
def __init__(self):
self.namespaces: Dict[str, str] = {}
def parse_file(self, file_path: str) -> ET.Element:
"""Parse XML file and return root element."""
tree = ET.parse(file_path)
root = tree.getroot()
# Extract namespaces
self._extract_namespaces(root)
return root
Next to this one in the catalogue, plus more from the same author.