---
name: XML Label Renamer
slug: xml-label-renamer
category: Automation
description: XML Label Renamer batch-replaces a specified tag name across XML annotation files in a directory. Use it to update dataset labels such as changing old_label to new_label.
github: "https://github.com/CoderWanFeng/python-office/tree/develop/skills/ruiming/change_label_in_xml"
language: Python
stars: 1339
forks: 301
install: "npx degit https://github.com/CoderWanFeng/python-office/tree/develop/skills/ruiming/change_label_in_xml ~/.claude/skills/change_label_in_xml"
installs_to: ~/.claude/skills/change_label_in_xml
source_path: skills/ruiming/change_label_in_xml/SKILL.md
collection_size: 50
category_size: 1523
collection_url: "https://dirskills.com/collections/CoderWanFeng/python-office"
added: 2026-08-12T04:43:10.502Z
last_synced: 2026-08-12T04:43:10.502Z
canonical_url: "https://dirskills.com/skills/xml-label-renamer"
---

# XML Label Renamer

XML Label Renamer batch-replaces a specified tag name across XML annotation files in a directory. Use it to update dataset labels such as changing old_label to new_label.

**Install:**

```bash
npx degit https://github.com/CoderWanFeng/python-office/tree/develop/skills/ruiming/change_label_in_xml ~/.claude/skills/change_label_in_xml
```

## README

# change_label_in_xml Skill

> 修改 XML 标注文件中的 label

## 功能描述

批量修改指定目录下所有 XML 标注文件中的标签名（old_label 替换为 new_label）。

## 所属分类

`office/skills/ruiming/change_label_in_xml/`

## 调用方式

```python
from skills.ruiming import change_label_in_xml

change_label_in_xml(
    dir_path='./dataset',
    old_label='cat',
    new_label='dog'
)
```

## 参数说明

| 参数 | 类型 | 必填 | 默认值 | 说明 |
|------|------|------|--------|------|
| `dir_path` | str | 是 | - | 图片及标注文件的存放路径 |
| `old_label` | str | 是 | - | 需要修改的标签 |
| `new_label` | str | 是 | - | 修改后的标签 |

## 返回值

`None`

## 使用示例

```python
from skills.ruiming import change_label_in_xml
change_label_in_xml(dir_path='./annotations', old_label='person', new_label='human')
```

## 原始函数

`office.api.testApi.ruiming.change_label_in_xml`
