json - 无法在 Azure 逻辑应用程序中解析具有空内容的 xml
问题描述
我得到一个具有以下结构的 XML
<?xml version="1.0" encoding="UTF-8"?>
<Data>
<datym>
<bla bla>
</datym>
<datym>
<bla bla>
</datym>
</Data>
这我可以成功解析为 json 并完成所有工作。有时我会得到一个具有以下格式的空 xml。
<?xml version="1.0" encoding="UTF-8"?>
<Data></data>
但是,这无法使用逻辑应用程序解析为 xml 或 json。那么,如果这是可解析的 XML 或空 XML,我该如何进行验证?我想在启动一个字符串后使用 contains() 函数,但这对性能造成了巨大的影响。
谢谢你的想法。
解决方案
我认为您的空 xml 示例直到可解析。我试图将 xml 文件解析为 json 文件。这是我的 xml 内容。
<Invoices
xmlns="http://gateway.com/schemas/Invoices"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://gateway..com/schemas/Invoices Invoices.xsd">
<DocumentInfo></DocumentInfo>
<Header></Header>
<Documents></Documents>
</Invoices>
解析后,这是json内容:
{
"Invoices": {
"@xmlns": "http://gateway.com/schemas/Invoices",
"@xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
"@xsi:schemaLocation":
"http://gateway..com/schemas/InvoicesInvoices.xsd",
"DocumentInfo": "",
"Header": "",
"Documents": ""
}
}
所以也许你可以参考我的逻辑应用流程。我使用 xml 文件作为显示。
希望这对您有所帮助,如果您还有其他问题,请告诉我。
推荐阅读
- python - 如何使用 Poetry 发布到 Azure Devops PyPI 提要?
- json - Json 对象的全局变量更改属性
- javascript - 如何使用 CreateJS / Tween 来影响鼠标移动时的视差 X 和 Y?
- django - 搜索时使用 django 过滤器时出现多项选择时出错
- python - 在 python 请求中处理井号 (#)
- vhdl - 如何定义记录类型的默认值
- macos - 如何减慢 GCD 并发队列的任务?
- c - 计算出现在大矩阵中的小矩阵中的字母数
- python - 在flask中创建一个webapp,在每个请求中生成一个新的html文件,但flask返回前一个
- php - 尽管插件激活成功,但实际上并未创建 Wordpress 自定义数据库表