Data Processing
使用XPath表达式从XML文档中提取值。非常适合从复杂的嵌套XML结构、API响应、RSS源和配置文件中提取特定数据。
Вызовите этот инструмент из своего кода на трёх языках.
curl -X POST 'https://api.elysiatools.com/ru/api/tools/xml-path-extractor' \
-H 'Content-Type: application/json' \
-d '{"xmlInput":"Enter your XML data...","xpathExpressions":"//*","outputFormat":"list","includePaths":true,"includeAttributes":false,"flattenArrays":true,"preserveOrder":true,"namespaceAware":false,"nullValues":false}'Отправьте POST-запрос с входными данными в JSON. Параметры типа «файл» требуют предварительной загрузки.
POST https://api.elysiatools.com/ru/api/tools/xml-path-extractor| Имя | Тип | Обязательный | Описание |
|---|---|---|---|
| xmlInput | textarea | Да | — |
| xpathExpressions | textarea | Нет | XPath expressions to extract values. Examples: //* - All elements //book/title - All book titles //person[@age>18] - Persons older than 18 Leave empty to extract all elements |
| outputFormat | select | Да | — |
| includePaths | checkbox | Нет | Include the XPath expression used for each extraction |
| includeAttributes | checkbox |
Добавьте этот инструмент на свой сервер Model Context Protocol, чтобы ИИ-агенты могли перечислять и вызывать его.
Добавьте этот блок в конфигурацию вашего MCP-клиента:
{
"mcpServers": {
"elysiatools-xml-path-extractor": {
"name": "xml-path-extractor",
"description": "使用XPath表达式从XML文档中提取值。非常适合从复杂的嵌套XML结构、API响应、RSS源和配置文件中提取特定数据。",
"baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=xml-path-extractor",
"command": "",
"args": [],
"env": {},
"isActive": true,
"type": "sse"
}
}
}После подключения к SSE-endpoint выведите список доступных инструментов:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}Вызовите инструмент по его id; аргументы формируются из его параметров:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "xml-path-extractor",
"arguments": {
"xmlInput": "Enter your XML data...",
"xpathExpressions": "//*",
"outputFormat": "list",
"includePaths": true,
"includeAttributes": false,
"flattenArrays": true,
"preserveOrder": true,
"namespaceAware": false,
"nullValues": false
}
}
}Вопросы или проблемы? Свяжитесь с [email protected]
| Include attributes for extracted elements |
| flattenArrays | checkbox | Нет | Treat multiple results as individual items instead of arrays |
| preserveOrder | checkbox | Нет | Maintain the original order of elements in the XML document |
| namespaceAware | checkbox | Нет | Enable namespace-aware XPath evaluation |
| nullValues | checkbox | Нет | Include empty elements and null values in the extraction results |
Текстовый результат
{
"result": "Processed text content",
"error": "Error message (optional)",
"message": "Notification message (optional)",
"metadata": {
"key": "value"
}
}