fix: strip ns0: namespace prefix in _extract_jrxml()

This commit is contained in:
2026-05-25 00:11:43 +08:00
parent 573ce012e7
commit 0adae3e06d
+3
View File
@@ -1677,6 +1677,9 @@ def _extract_jrxml(text: str) -> str:
3. 纯 JRXML 无包装 3. 纯 JRXML 无包装
""" """
text = text.strip() text = text.strip()
# 清理 LLM 输出的 ns0: 命名空间前缀和声明
text = text.replace("ns0:", "")
text = re.sub(r'\s+xmlns:ns0="[^"]*"', "", text)
# 检测并提取 markdown 代码块中的内容 # 检测并提取 markdown 代码块中的内容
# 如果第一个代码块的内容看起来是完整 JRXML(以 <?xml 或 <jasperReport 开头), # 如果第一个代码块的内容看起来是完整 JRXML(以 <?xml 或 <jasperReport 开头),
# 则返回它;否则跳过该块,回退到其他提取方式。 # 则返回它;否则跳过该块,回退到其他提取方式。