String xmldata ='<?xml version="1.0" encoding="utf-8"?>'
+ "<String type ='basic_registration_mobile'"
+ " Terminal_Number ='10'"
+ " Terminal_Name='PayQwik'>"
<Machine_Id>ertiueoirtueo</Machine_Id>
<Mobile_num>9980066466</Mobile_num>
<Password>dklgfjkld</Password>
<Email_Id>rututhipse@g.com</Email_Id>
<Date>2014-09-25 11:34:45</Date>
<Gender>M</Gender>
<Photo></Photo>
<Address>45456tgdfg</Address>
</String>";
此String显示无效的字符常量。如何解决它
答案 0 :(得分:0)
您在<Machine_Id>
之前缺少字符串连接。如果它允许多行字符串而不是地方+操作符和<Machine_Id>
之前的双重引号
String xmldata ='<?xml version="1.0" encoding="utf-8"?>'
+ "<String type ='basic_registration_mobile'"
+ " Terminal_Number ='10'"
+ " Terminal_Name='PayQwik'>"
+ "<Machine_Id>ertiueoirtueo</Machine_Id>
<Mobile_num>9980066466</Mobile_num>
<Password>dklgfjkld</Password>
<Email_Id>rututhipse@g.com</Email_Id>
<Date>2014-09-25 11:34:45</Date>
<Gender>M</Gender>
<Photo></Photo>
<Address>45456tgdfg</Address>
</String>";
修改强>
替换此块
String xmldata ='<?xml version="1.0" encoding="utf-8"?>'
+ "<String type ='basic_registration_mobile'"
+ " Terminal_Number ='10'"
+ " Terminal_Name='PayQwik'>"
带
String xmldata ="<?xml version=\"1.0\" encoding=\"utf-8\"?>"
+ "<String type =\"basic_registration_mobile\""
+ " Terminal_Number =\"10\""
+ " Terminal_Name=\"PayQwik\">"