问题
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>
However, we we try to parse the file it fails because of "invalid URI character '\' is not allowed.
Is backslash not allowed within the xsi:schemaLocation attribute?
Thanks!
回答1:
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.
来源:https://stackoverflow.com/questions/24406203/xsischemalocation-backslash-not-allowed