Data Processing
使用XPath表达式从XML文档中提取值。非常适合从复杂的嵌套XML结构、API响应、RSS源和配置文件中提取特定数据。
Chame esta ferramenta a partir do seu código em três idiomas.
curl -X POST 'https://api.elysiatools.com/pt/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}'Envie uma requisição POST com suas entradas em JSON. Parâmetros do tipo arquivo exigem upload prévio.
POST https://api.elysiatools.com/pt/api/tools/xml-path-extractor| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
| xmlInput | textarea | Sim | — |
| xpathExpressions | textarea | Não | 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 | Sim | — |
| includePaths | checkbox | Não | Include the XPath expression used for each extraction |
| includeAttributes | checkbox |
Adicione esta ferramenta ao seu servidor Model Context Protocol para que agentes de IA possam listá-la e chamá-la.
Adicione este bloco à configuração do seu cliente 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"
}
}
}Após conectar ao endpoint SSE, liste as ferramentas expostas:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}Invoque a ferramenta pelo seu id; os argumentos são construídos a partir de seus parâmetros:
{
"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
}
}
}Dúvidas ou problemas? Contate [email protected]
| Não |
| Include attributes for extracted elements |
| flattenArrays | checkbox | Não | Treat multiple results as individual items instead of arrays |
| preserveOrder | checkbox | Não | Maintain the original order of elements in the XML document |
| namespaceAware | checkbox | Não | Enable namespace-aware XPath evaluation |
| nullValues | checkbox | Não | Include empty elements and null values in the extraction results |
Resultado de texto
{
"result": "Processed text content",
"error": "Error message (optional)",
"message": "Notification message (optional)",
"metadata": {
"key": "value"
}
}