我收到类似Java的异常:
java.net.MalformedURLException: no protocol
我的程序尝试使用以下方法解析XML字符串:
Document dom;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
dom = db.parse(xml);
XML字符串包含:
String xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"+
" <s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">"+
" <s:Header>"+
" <ActivityId CorrelationId=\"15424263-3c01-4709-bec3-740d1ab15a38\" xmlns=\"http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics\">50d69ff9-8cf3-4c20-afe5-63a9047348ad</ActivityId>"+
" <clalLog_CorrelationId xmlns=\"http://clalbit.co.il/clallog\">eb791540-ad6d-48a3-914d-d74f57d88179</clalLog_CorrelationId>"+
" </s:Header>"+
" <s:Body>"+
" <ValidatePwdAndIPResponse xmlns=\"http://tempuri.org/\">"+
" <ValidatePwdAndIPResult xmlns:a=\"http://schemas.datacontract.org/2004/07/ClalBit.ClalnetMediator.Contracts\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">"+
" <a:ErrorMessage>Valid User</a:ErrorMessage>"+
" <a:FullErrorMessage i:nil=\"true\" />"+
" <a:IsSuccess>true</a:IsSuccess>"+
" <a:SecurityToken>999993_310661843</a:SecurityToken>"+
" </ValidatePwdAndIPResult>"+
" </ValidatePwdAndIPResponse>"+
" </s:Body>\n"+
" </s:Envelope>\n";
关于造成此错误的原因有什么建议吗?
您到底从哪里得到该错误消息?在解析XML或尝试通过网络发送XML时?如果您在解析时得到此消息,那将真的很奇怪。
—
杰斯珀,