XML 用例:导入 XML 数据
初级
这是一个Engineering, Building Blocks领域的自动化工作流,包含 0 个节点。 XML 到 SQL 数据库导入
前置要求
- •无特殊前置要求,导入即可使用
使用的节点 (0)
没有找到匹配的工作流
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "5x5q3sta3Qh0MdIX",
"meta": {
"instanceId": "fb924c73af8f703905bc09c9ee8076f48c17b596ed05b18c0ff86915ef8a7c4a"
},
"name": "XML 用例:导入 XML 数据",
"tags": [],
"nodes": [
{
"id": "19a81ae3-6ef6-46b0-aaa7-2ddcad1c86cb",
"name": "当点击\"执行工作流\"时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
700,
360
],
"parameters": {},
"typeVersion": 1
},
{
"id": "495356fb-8132-40c2-bfd8-559cd1a03bf8",
"name": "读取二进制文件",
"type": "n8n-nodes-base.readBinaryFiles",
"position": [
900,
360
],
"parameters": {
"fileSelector": "/home/node/.n8n/intermediate.xml"
},
"typeVersion": 1
},
{
"id": "9c88e06c-66be-4f62-a30e-811171fec34b",
"name": "项目列表",
"type": "n8n-nodes-base.itemLists",
"position": [
1500,
360
],
"parameters": {
"options": {},
"fieldToSplitOut": "Products.Product"
},
"typeVersion": 3
},
{
"id": "a8aeb5c8-bb7a-4990-8a07-565c2d9e2760",
"name": "提取二进制数据",
"type": "n8n-nodes-base.code",
"position": [
1100,
360
],
"parameters": {
"jsCode": "let binaryDataBufferItem = await this.helpers.getBinaryDataBuffer(0, 'data');\nvar data = binaryDataBufferItem.toString('utf8')\n\nreturn {\"data\": data};"
},
"typeVersion": 2
},
{
"id": "7a37802d-e0b7-4520-8832-8d43fa5815a0",
"name": "XML 转 JSON",
"type": "n8n-nodes-base.xml",
"position": [
1300,
360
],
"parameters": {
"options": {
"trim": false,
"attrkey": "$",
"normalize": false,
"mergeAttrs": true,
"ignoreAttrs": false,
"normalizeTags": false
}
},
"typeVersion": 1
},
{
"id": "e5bca22c-7941-46d0-ba2d-d375cb4735c9",
"name": "添加新记录",
"type": "n8n-nodes-base.mySql",
"position": [
1700,
360
],
"parameters": {
"table": {
"__rl": true,
"mode": "list",
"value": "new_table",
"cachedResultName": "new_table"
},
"options": {
"detailedOutput": true
},
"dataMode": "defineBelow",
"valuesToSend": {
"values": [
{
"value": "={{ $json.Code }}",
"column": "productCode"
},
{
"value": "={{ $json.Name }}",
"column": "productName"
},
{
"value": "={{ $json.Line }}",
"column": "productLine"
},
{
"value": "={{ $json.Scale }}",
"column": "productScale"
},
{
"value": "={{ $json.Description }}",
"column": "productDescription"
},
{
"value": "={{ $json.Price }}",
"column": "MSRP"
},
{
"value": "NA",
"column": "productVendor"
},
{
"value": "0",
"column": "quantityInStock"
},
{
"value": "0",
"column": "buyPrice"
}
]
}
},
"credentials": {
"mySql": {
"id": "EEPqCgKBDiRRZ3ua",
"name": "db4free MySQL"
}
},
"typeVersion": 2.2
},
{
"id": "b787244f-aebf-4ec7-ba84-4b9409e30817",
"name": "创建新表",
"type": "n8n-nodes-base.mySql",
"disabled": true,
"position": [
900,
80
],
"parameters": {
"query": "CREATE TABLE IF NOT EXISTS new_table AS SELECT * FROM products;\nTRUNCATE new_table;\n",
"options": {},
"operation": "executeQuery"
},
"credentials": {
"mySql": {
"id": "EEPqCgKBDiRRZ3ua",
"name": "db4free MySQL"
}
},
"typeVersion": 2.2
},
{
"id": "49b8214d-bc98-441c-847d-158a35c6fefa",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
720,
-40
],
"parameters": {
"width": 503,
"height": 317,
"content": "### 仅在需要时激活并执行此节点。"
},
"typeVersion": 1
},
{
"id": "28533467-5e12-4f7c-9310-8c88708bcff9",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
680,
560
],
"parameters": {
"width": 553.5746606334839,
"height": 268.9366515837105,
"content": "## 这是示例 XML 文件的内容。"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "25ab0ab6-6689-48ad-967e-2a2fb0743ece",
"connections": {
"Item Lists": {
"main": [
[
{
"node": "Add new records",
"type": "main",
"index": 0
}
]
]
},
"XML to JSON": {
"main": [
[
{
"node": "Item Lists",
"type": "main",
"index": 0
}
]
]
},
"Read Binary Files": {
"main": [
[
{
"node": "Extract binary data",
"type": "main",
"index": 0
}
]
]
},
"Extract binary data": {
"main": [
[
{
"node": "XML to JSON",
"type": "main",
"index": 0
}
]
]
},
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "Read Binary Files",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
初级 - 工程, 构建模块
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
GitHub仓库被复刻时在Pipedrive中添加新线索
GitHub仓库被复刻时在Pipedrive中添加新线索
If
Set
Pipedrive
+2
8 节点n8n Team
销售
CSV到JSON转换器(错误处理与Slack通知)
具有错误处理和Slack通知功能的CSV到JSON转换器
If
Set
Code
+8
18 节点n8n Team
工程
从URL导入CSV到GoogleSheet
从URL导入CSV到Google Sheets
0 节点n8n Team
构建模块
导入多个CSV到GoogleSheet
导入多个CSV到Google Sheets
0 节点n8n Team
构建模块
Snowflake数据加载
将CSV数据加载到Snowflake
Set
Snowflake
Http Request
+2
5 节点n8n Team
工程
基于语言合并用户问候语
根据语言合并用户问候语
Merge
Function
Manual Trigger
4 节点n8n Team
构建模块
工作流信息
难度等级
初级
节点数量0
分类2
节点类型0
作者
n8n Team
@n8n-teamMeet the official n8n team. We specialize in building workflows that transform intricate tasks into seamless operations.
外部链接
在 n8n.io 查看 →
分享此工作流