{
  "schemaVersion": "1.0",
  "item": {
    "slug": "xml-reader",
    "name": "Xml Reader",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/datadrivenconstruction/xml-reader",
    "canonicalUrl": "https://clawhub.ai/datadrivenconstruction/xml-reader",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/xml-reader",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=xml-reader",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "claw.json",
      "instructions.md",
      "SKILL.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "slug": "xml-reader",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-11T06:58:45.819Z",
      "expiresAt": "2026-05-18T06:58:45.819Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=xml-reader",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=xml-reader",
        "contentDisposition": "attachment; filename=\"xml-reader-2.1.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "xml-reader"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/xml-reader"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/xml-reader",
    "agentPageUrl": "https://openagent3.xyz/skills/xml-reader/agent",
    "manifestUrl": "https://openagent3.xyz/skills/xml-reader/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/xml-reader/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Overview",
        "body": "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."
      },
      {
        "title": "Python Implementation",
        "body": "import xml.etree.ElementTree as ET\nimport pandas as pd\nfrom typing import Dict, Any, List, Optional, Union\nfrom dataclasses import dataclass\nfrom pathlib import Path\nimport re\n\n\n@dataclass\nclass XMLElement:\n    \"\"\"Parsed XML element.\"\"\"\n    tag: str\n    attributes: Dict[str, str]\n    text: Optional[str]\n    children: List['XMLElement']\n\n\nclass ConstructionXMLReader:\n    \"\"\"Parse XML from construction systems.\"\"\"\n\n    def __init__(self):\n        self.namespaces: Dict[str, str] = {}\n\n    def parse_file(self, file_path: str) -> ET.Element:\n        \"\"\"Parse XML file and return root element.\"\"\"\n        tree = ET.parse(file_path)\n        root = tree.getroot()\n\n        # Extract namespaces\n        self._extract_namespaces(root)\n\n        return root\n\n    def parse_string(self, xml_string: str) -> ET.Element:\n        \"\"\"Parse XML from string.\"\"\"\n        root = ET.fromstring(xml_string)\n        self._extract_namespaces(root)\n        return root\n\n    def _extract_namespaces(self, root: ET.Element):\n        \"\"\"Extract namespace mappings.\"\"\"\n        # Find namespace declarations\n        for attr, value in root.attrib.items():\n            if attr.startswith('{'):\n                ns = attr[1:attr.index('}')]\n                self.namespaces[root.tag.split('}')[0][1:]] = ns\n\n    def find_elements(self, root: ET.Element,\n                      tag: str,\n                      namespace: str = None) -> List[ET.Element]:\n        \"\"\"Find all elements with given tag.\"\"\"\n        if namespace:\n            tag = f\"{{{namespace}}}{tag}\"\n        return root.findall(f\".//{tag}\")\n\n    def element_to_dict(self, element: ET.Element,\n                        include_children: bool = True) -> Dict[str, Any]:\n        \"\"\"Convert element to dictionary.\"\"\"\n        result = {\n            '_tag': element.tag.split('}')[-1] if '}' in element.tag else element.tag,\n            '_text': element.text.strip() if element.text else None,\n            **element.attrib\n        }\n\n        if include_children:\n            for child in element:\n                child_tag = child.tag.split('}')[-1] if '}' in child.tag else child.tag\n\n                if child_tag in result:\n                    # Multiple children with same tag - make list\n                    if not isinstance(result[child_tag], list):\n                        result[child_tag] = [result[child_tag]]\n                    result[child_tag].append(self.element_to_dict(child))\n                else:\n                    result[child_tag] = self.element_to_dict(child)\n\n        return result\n\n    def elements_to_dataframe(self, elements: List[ET.Element]) -> pd.DataFrame:\n        \"\"\"Convert list of elements to DataFrame.\"\"\"\n        records = []\n        for elem in elements:\n            record = {'_tag': elem.tag.split('}')[-1]}\n            record.update(elem.attrib)\n\n            # Get direct text content\n            if elem.text and elem.text.strip():\n                record['_text'] = elem.text.strip()\n\n            # Get child values\n            for child in elem:\n                child_tag = child.tag.split('}')[-1]\n                if child.text and child.text.strip():\n                    record[child_tag] = child.text.strip()\n                # Also get child attributes\n                for attr, val in child.attrib.items():\n                    record[f\"{child_tag}_{attr}\"] = val\n\n            records.append(record)\n\n        return pd.DataFrame(records)\n\n    def flatten_xml(self, root: ET.Element,\n                    target_tag: str = None) -> pd.DataFrame:\n        \"\"\"Flatten XML to DataFrame.\"\"\"\n        if target_tag:\n            elements = self.find_elements(root, target_tag)\n        else:\n            elements = list(root)\n\n        return self.elements_to_dataframe(elements)\n\n\nclass P6XMLReader(ConstructionXMLReader):\n    \"\"\"Reader for Primavera P6 XML exports.\"\"\"\n\n    def parse_activities(self, root: ET.Element) -> pd.DataFrame:\n        \"\"\"Parse activities from P6 XML.\"\"\"\n        activities = self.find_elements(root, 'Activity')\n        return self.elements_to_dataframe(activities)\n\n    def parse_resources(self, root: ET.Element) -> pd.DataFrame:\n        \"\"\"Parse resources from P6 XML.\"\"\"\n        resources = self.find_elements(root, 'Resource')\n        return self.elements_to_dataframe(resources)\n\n    def parse_wbs(self, root: ET.Element) -> pd.DataFrame:\n        \"\"\"Parse WBS from P6 XML.\"\"\"\n        wbs = self.find_elements(root, 'WBS')\n        return self.elements_to_dataframe(wbs)\n\n    def parse_full_schedule(self, file_path: str) -> Dict[str, pd.DataFrame]:\n        \"\"\"Parse complete P6 schedule.\"\"\"\n        root = self.parse_file(file_path)\n        return {\n            'activities': self.parse_activities(root),\n            'resources': self.parse_resources(root),\n            'wbs': self.parse_wbs(root)\n        }\n\n\nclass IFCXMLReader(ConstructionXMLReader):\n    \"\"\"Reader for IFC-XML files.\"\"\"\n\n    def parse_entities(self, root: ET.Element) -> pd.DataFrame:\n        \"\"\"Parse IFC entities.\"\"\"\n        # Find all Ifc* elements\n        all_entities = []\n        for elem in root.iter():\n            if elem.tag.startswith('Ifc'):\n                all_entities.append(elem)\n        return self.elements_to_dataframe(all_entities)\n\n    def get_entity_types(self, root: ET.Element) -> Dict[str, int]:\n        \"\"\"Count entity types.\"\"\"\n        counts = {}\n        for elem in root.iter():\n            tag = elem.tag\n            if tag.startswith('Ifc'):\n                counts[tag] = counts.get(tag, 0) + 1\n        return counts\n\n\nclass COBieXMLReader(ConstructionXMLReader):\n    \"\"\"Reader for COBie XML files.\"\"\"\n\n    COBIE_SHEETS = ['Facility', 'Floor', 'Space', 'Zone', 'Type',\n                    'Component', 'System', 'Assembly', 'Connection',\n                    'Spare', 'Resource', 'Job', 'Document', 'Attribute']\n\n    def parse_cobie(self, file_path: str) -> Dict[str, pd.DataFrame]:\n        \"\"\"Parse all COBie sheets.\"\"\"\n        root = self.parse_file(file_path)\n        result = {}\n\n        for sheet in self.COBIE_SHEETS:\n            elements = self.find_elements(root, sheet)\n            if elements:\n                result[sheet] = self.elements_to_dataframe(elements)\n\n        return result\n\n\nclass BSDDXMLReader(ConstructionXMLReader):\n    \"\"\"Reader for buildingSMART Data Dictionary exports.\"\"\"\n\n    def parse_classifications(self, root: ET.Element) -> pd.DataFrame:\n        \"\"\"Parse classification items.\"\"\"\n        items = self.find_elements(root, 'Classification')\n        return self.elements_to_dataframe(items)\n\n    def parse_properties(self, root: ET.Element) -> pd.DataFrame:\n        \"\"\"Parse property definitions.\"\"\"\n        props = self.find_elements(root, 'Property')\n        return self.elements_to_dataframe(props)"
      },
      {
        "title": "Quick Start",
        "body": "reader = ConstructionXMLReader()\n\n# Parse XML file\nroot = reader.parse_file(\"schedule.xml\")\n\n# Find specific elements\nactivities = reader.find_elements(root, \"Activity\")\nprint(f\"Found {len(activities)} activities\")\n\n# Convert to DataFrame\ndf = reader.elements_to_dataframe(activities)"
      },
      {
        "title": "1. P6 Schedule Import",
        "body": "p6_reader = P6XMLReader()\nschedule = p6_reader.parse_full_schedule(\"p6_export.xml\")\n\nactivities = schedule['activities']\nprint(f\"Activities: {len(activities)}\")"
      },
      {
        "title": "2. COBie Data",
        "body": "cobie_reader = COBieXMLReader()\ncobie_data = cobie_reader.parse_cobie(\"facility_cobie.xml\")\n\ncomponents = cobie_data.get('Component', pd.DataFrame())"
      },
      {
        "title": "3. IFC-XML Analysis",
        "body": "ifc_reader = IFCXMLReader()\nroot = ifc_reader.parse_file(\"model.ifcxml\")\n\n# Count entity types\ntypes = ifc_reader.get_entity_types(root)\nfor entity_type, count in sorted(types.items(), key=lambda x: -x[1])[:10]:\n    print(f\"{entity_type}: {count}\")"
      },
      {
        "title": "Resources",
        "body": "DDC Book: Chapter 2.1 - Semi-structured Data\nIFC-XML: buildingSMART specification"
      }
    ],
    "body": "XML Reader for Construction Data\nOverview\n\nXML 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.\n\nPython Implementation\nimport xml.etree.ElementTree as ET\nimport pandas as pd\nfrom typing import Dict, Any, List, Optional, Union\nfrom dataclasses import dataclass\nfrom pathlib import Path\nimport re\n\n\n@dataclass\nclass XMLElement:\n    \"\"\"Parsed XML element.\"\"\"\n    tag: str\n    attributes: Dict[str, str]\n    text: Optional[str]\n    children: List['XMLElement']\n\n\nclass ConstructionXMLReader:\n    \"\"\"Parse XML from construction systems.\"\"\"\n\n    def __init__(self):\n        self.namespaces: Dict[str, str] = {}\n\n    def parse_file(self, file_path: str) -> ET.Element:\n        \"\"\"Parse XML file and return root element.\"\"\"\n        tree = ET.parse(file_path)\n        root = tree.getroot()\n\n        # Extract namespaces\n        self._extract_namespaces(root)\n\n        return root\n\n    def parse_string(self, xml_string: str) -> ET.Element:\n        \"\"\"Parse XML from string.\"\"\"\n        root = ET.fromstring(xml_string)\n        self._extract_namespaces(root)\n        return root\n\n    def _extract_namespaces(self, root: ET.Element):\n        \"\"\"Extract namespace mappings.\"\"\"\n        # Find namespace declarations\n        for attr, value in root.attrib.items():\n            if attr.startswith('{'):\n                ns = attr[1:attr.index('}')]\n                self.namespaces[root.tag.split('}')[0][1:]] = ns\n\n    def find_elements(self, root: ET.Element,\n                      tag: str,\n                      namespace: str = None) -> List[ET.Element]:\n        \"\"\"Find all elements with given tag.\"\"\"\n        if namespace:\n            tag = f\"{{{namespace}}}{tag}\"\n        return root.findall(f\".//{tag}\")\n\n    def element_to_dict(self, element: ET.Element,\n                        include_children: bool = True) -> Dict[str, Any]:\n        \"\"\"Convert element to dictionary.\"\"\"\n        result = {\n            '_tag': element.tag.split('}')[-1] if '}' in element.tag else element.tag,\n            '_text': element.text.strip() if element.text else None,\n            **element.attrib\n        }\n\n        if include_children:\n            for child in element:\n                child_tag = child.tag.split('}')[-1] if '}' in child.tag else child.tag\n\n                if child_tag in result:\n                    # Multiple children with same tag - make list\n                    if not isinstance(result[child_tag], list):\n                        result[child_tag] = [result[child_tag]]\n                    result[child_tag].append(self.element_to_dict(child))\n                else:\n                    result[child_tag] = self.element_to_dict(child)\n\n        return result\n\n    def elements_to_dataframe(self, elements: List[ET.Element]) -> pd.DataFrame:\n        \"\"\"Convert list of elements to DataFrame.\"\"\"\n        records = []\n        for elem in elements:\n            record = {'_tag': elem.tag.split('}')[-1]}\n            record.update(elem.attrib)\n\n            # Get direct text content\n            if elem.text and elem.text.strip():\n                record['_text'] = elem.text.strip()\n\n            # Get child values\n            for child in elem:\n                child_tag = child.tag.split('}')[-1]\n                if child.text and child.text.strip():\n                    record[child_tag] = child.text.strip()\n                # Also get child attributes\n                for attr, val in child.attrib.items():\n                    record[f\"{child_tag}_{attr}\"] = val\n\n            records.append(record)\n\n        return pd.DataFrame(records)\n\n    def flatten_xml(self, root: ET.Element,\n                    target_tag: str = None) -> pd.DataFrame:\n        \"\"\"Flatten XML to DataFrame.\"\"\"\n        if target_tag:\n            elements = self.find_elements(root, target_tag)\n        else:\n            elements = list(root)\n\n        return self.elements_to_dataframe(elements)\n\n\nclass P6XMLReader(ConstructionXMLReader):\n    \"\"\"Reader for Primavera P6 XML exports.\"\"\"\n\n    def parse_activities(self, root: ET.Element) -> pd.DataFrame:\n        \"\"\"Parse activities from P6 XML.\"\"\"\n        activities = self.find_elements(root, 'Activity')\n        return self.elements_to_dataframe(activities)\n\n    def parse_resources(self, root: ET.Element) -> pd.DataFrame:\n        \"\"\"Parse resources from P6 XML.\"\"\"\n        resources = self.find_elements(root, 'Resource')\n        return self.elements_to_dataframe(resources)\n\n    def parse_wbs(self, root: ET.Element) -> pd.DataFrame:\n        \"\"\"Parse WBS from P6 XML.\"\"\"\n        wbs = self.find_elements(root, 'WBS')\n        return self.elements_to_dataframe(wbs)\n\n    def parse_full_schedule(self, file_path: str) -> Dict[str, pd.DataFrame]:\n        \"\"\"Parse complete P6 schedule.\"\"\"\n        root = self.parse_file(file_path)\n        return {\n            'activities': self.parse_activities(root),\n            'resources': self.parse_resources(root),\n            'wbs': self.parse_wbs(root)\n        }\n\n\nclass IFCXMLReader(ConstructionXMLReader):\n    \"\"\"Reader for IFC-XML files.\"\"\"\n\n    def parse_entities(self, root: ET.Element) -> pd.DataFrame:\n        \"\"\"Parse IFC entities.\"\"\"\n        # Find all Ifc* elements\n        all_entities = []\n        for elem in root.iter():\n            if elem.tag.startswith('Ifc'):\n                all_entities.append(elem)\n        return self.elements_to_dataframe(all_entities)\n\n    def get_entity_types(self, root: ET.Element) -> Dict[str, int]:\n        \"\"\"Count entity types.\"\"\"\n        counts = {}\n        for elem in root.iter():\n            tag = elem.tag\n            if tag.startswith('Ifc'):\n                counts[tag] = counts.get(tag, 0) + 1\n        return counts\n\n\nclass COBieXMLReader(ConstructionXMLReader):\n    \"\"\"Reader for COBie XML files.\"\"\"\n\n    COBIE_SHEETS = ['Facility', 'Floor', 'Space', 'Zone', 'Type',\n                    'Component', 'System', 'Assembly', 'Connection',\n                    'Spare', 'Resource', 'Job', 'Document', 'Attribute']\n\n    def parse_cobie(self, file_path: str) -> Dict[str, pd.DataFrame]:\n        \"\"\"Parse all COBie sheets.\"\"\"\n        root = self.parse_file(file_path)\n        result = {}\n\n        for sheet in self.COBIE_SHEETS:\n            elements = self.find_elements(root, sheet)\n            if elements:\n                result[sheet] = self.elements_to_dataframe(elements)\n\n        return result\n\n\nclass BSDDXMLReader(ConstructionXMLReader):\n    \"\"\"Reader for buildingSMART Data Dictionary exports.\"\"\"\n\n    def parse_classifications(self, root: ET.Element) -> pd.DataFrame:\n        \"\"\"Parse classification items.\"\"\"\n        items = self.find_elements(root, 'Classification')\n        return self.elements_to_dataframe(items)\n\n    def parse_properties(self, root: ET.Element) -> pd.DataFrame:\n        \"\"\"Parse property definitions.\"\"\"\n        props = self.find_elements(root, 'Property')\n        return self.elements_to_dataframe(props)\n\nQuick Start\nreader = ConstructionXMLReader()\n\n# Parse XML file\nroot = reader.parse_file(\"schedule.xml\")\n\n# Find specific elements\nactivities = reader.find_elements(root, \"Activity\")\nprint(f\"Found {len(activities)} activities\")\n\n# Convert to DataFrame\ndf = reader.elements_to_dataframe(activities)\n\nCommon Use Cases\n1. P6 Schedule Import\np6_reader = P6XMLReader()\nschedule = p6_reader.parse_full_schedule(\"p6_export.xml\")\n\nactivities = schedule['activities']\nprint(f\"Activities: {len(activities)}\")\n\n2. COBie Data\ncobie_reader = COBieXMLReader()\ncobie_data = cobie_reader.parse_cobie(\"facility_cobie.xml\")\n\ncomponents = cobie_data.get('Component', pd.DataFrame())\n\n3. IFC-XML Analysis\nifc_reader = IFCXMLReader()\nroot = ifc_reader.parse_file(\"model.ifcxml\")\n\n# Count entity types\ntypes = ifc_reader.get_entity_types(root)\nfor entity_type, count in sorted(types.items(), key=lambda x: -x[1])[:10]:\n    print(f\"{entity_type}: {count}\")\n\nResources\nDDC Book: Chapter 2.1 - Semi-structured Data\nIFC-XML: buildingSMART specification"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/datadrivenconstruction/xml-reader",
    "publisherUrl": "https://clawhub.ai/datadrivenconstruction/xml-reader",
    "owner": "datadrivenconstruction",
    "version": "2.1.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/xml-reader",
    "downloadUrl": "https://openagent3.xyz/downloads/xml-reader",
    "agentUrl": "https://openagent3.xyz/skills/xml-reader/agent",
    "manifestUrl": "https://openagent3.xyz/skills/xml-reader/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/xml-reader/agent.md"
  }
}