MerrimanInd / MerrimanInd/drawpyo
load_mxlibrary: support multi-cell stencil icons (e.g. OCI Library.xml)
- Dominant language
- Python
- Stars
- 412
- Forks
- 48
- PR merge metrics
- No merged PRs in 30d
Description
## Problem
`load_mxlibrary()` fails to parse icons from Oracle's official **OCI Architecture Diagram Toolkit** (`OCI Library.xml`,
224 icons). All 224 items return `"No valid mxCell found in XML"`.
The issue is that OCI icons are **multi-cell Visio stencils** — each icon is an `mxGraphModel` containing 4-15 nested
`mxCell` elements with `shape=stencil(...)` data. The current parser expects a single `mxCell` per library item.
## Reproduction
```python
import drawpyo
# This works (Azure icons are single-cell):
drawpyo.register_mxlibrary(
"azure",
"https://raw.githubusercontent.com/dwarfered/azure-architecture-icons-for-drawio/main/azure-public-service-icons/004%2
0azure%20ecosystem.xml"
)
# This fails (OCI icons are multi-cell):
shapes = drawpyo.load_mxlibrary("OCI Library.xml") # 0 shapes found
# WARNING: No valid mxCell found in XML (224 errors)
```
## Root Cause
Each OCI library item's decoded XML contains multiple mxCells with parent hierarchy:
```xml
```
## Expected Behavior
`load_mxlibrary()` should handle multi-cell items — return all cells as a group/composite, or at minimum not silently
discard them.
## Impact
OCI Library is Oracle's official draw.io icon set (224 icons), downloaded from:
https://docs.oracle.com/en-us/iaas/Content/General/Reference/graphicsfordiagrams.htm
Other vendor libraries may have similar multi-cell structures.
Contributor guide
Research direction
Start at load_mxlibrary and reproduce the failure with OCI Library.xml, inspecting each decoded mxGraphModel/root and its parent-linked mxCell elements. Done means multi-cell library items are retained as a group or composite instead of being discarded, while preserving support for the existing single-cell libraries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100