本文介绍了xsi:schemaLocation 不允许反斜杠?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们收到一个如下所示的 xml 文件:
we are receiving an xml file that looks like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AuditResponse xmlns="http://www.tibco.com/MFT/JMS-XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.tibco.com/MFT/JMS-XMLSchema C:\MFTIS\server\webapps\cfcc\WEB-INF/xsds/AuditResponse.xsd">
<ResponseType>TransferNotificationComplete</ResponseType>
<NumRecords>1</NumRecords>
<AuditRecord>
<AuditType>InternetServer</AuditType>
<AuditID>A62540000004</AuditID>
<CKPTInterval>5</CKPTInterval>
</AuditRecord>
</AuditResponse>
但是,我们尝试解析失败的文件,因为不允许使用无效的 URI 字符 '\'.
However, we we try to parse the file it fails because of "invalid URI character '\' is not allowed.
在 xsi:schemaLocation 属性中是否不允许使用反斜杠?
Is backslash not allowed within the xsi:schemaLocation attribute?
谢谢!
推荐答案
schemaLocation
被定义为包含成对的 URI,并且 \
是根据 RFC 2396 排除的字符. 所以,是的,解析器是正确的.不过,\
可以转义.
schemaLocation
is defined to contain pairs of URIs, and \
is an excluded character according to RFC 2396. So, yes, the parser is kind of correct to barf on it. \
can be escaped, though.
这篇关于xsi:schemaLocation 不允许反斜杠?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!