Для жизни я не могу понять, почему я получаю ошибку синтаксического анализа XML для URL-адреса действия объекта ответа Twilio. Я прикрепил как ошибку выходной страницы, так и код java, который я использую для генерации XML.Ошибка анализа XML: неверно сформирована для Twilio
OUTPUT ERROR
XML Parsing Error: not well-formed
Location: https://test.ignore.com/ApplicationName/go.acx?action=ivr.outbound.twilio.Introduction&rkey=1
Line Number 4, Column 101:<Response><Gather action="instanceurl.com/AccessWorx/go.acx?action=ivr.outbound.twilio.Selection&rkey=1" timeout="5" numDigits="1" finishOnKey="#" method="GET"><Say>This is an automated message from __________ to notify you of a service issue.Here is a sample message. Press 1 to accept this serviceissue, Press 2 to forward this call to the next contact in you company, press 3 if you are not the correct person to contact, press 4 to repeat these options.</Say></Gather></Response>
----------------------------------------------------------------------------------------------------^
Символ^не совпадает в приведенном выше форматирование кода, но его по существу, указывая на «=» знак в rkey = 1 в конце URL действия.
JAVA CODE
StringBuffer sb = new StringBuffer();
sb.append("This is an automated message from ___________ to notify you of a service issue.")
.append(serviceMessage)
.append("Press 1 to accept this service"
+ "issue, Press 2 to forward this call to the next contact in you company, press 3 "
+ "if you are not the correct person to contact, press 4 to repeat these options.");
// Create a TwiML response and add our friendly message.
TwiMLResponse twiml = new TwiMLResponse();
Say say = new Say(sb.toString());
Gather g = new Gather();
// set url to selection with paramter for rkey
IVRAgent ivrAgent = new IVRAgent();
g.setAction(ivrAgent.buildActionUrl(callBean.getInstanceUrl() + "go.acx?", "ivr.outbound.twilio.Selection", rkey.toString()));
g.setTimeout(TIMEOUT);
g.setNumDigits(1);
g.setFinishOnKey(POUND);
g.setMethod("GET");
try {
g.append(say);
twiml.append(g);
} catch (TwiMLException e) {
log.error("Error in creating twiml", e);
e.printStackTrace();
}
Проверьте это http://stackoverflow.com/questions/1328538/how-do-i-escape-ampersands-in-xml. Попробуйте избежать этого символа '&'. –
Спасибо, Бхеш ... оказывается, ты был прав! Что-то вроде вопросов о публикации, кажется, сразу направляет вас к вашему собственному ответу. – user2671774
Да. Если вы читаете ответы в ссылке, вы также можете увидеть похожие впечатления от плакатов. :) –