如何在Android.org.apache.harmony.xml.ExpatParser中的Asset文件夹中的xml文件中良好地形成$ ParseException:在第19行,第24列:格式不正确(无效令牌) 在org.apache.harmony.xml.ExpatParser.parseFragment(ExpatParser.java:520) 在org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:479)
这是xml文件
<?xml version="1.0" encoding="UTF-8"?>
<menu>
<item>
<QNO>50</QNO>
<QUESTIONS>Which declaration of the main method below would allow a class to be started as a standalone program. Select the one correct answer.</QUESTIONS>
<ANSWER>35,35</ANSWER>
<OPTIONA>35,35</OPTIONA>
<OPTIONB>35,40</OPTIONB>
<OPTIONC>36,32</OPTIONC>
<OPTIOND>None of these</OPTIOND>
<EXPLAINATION>NONE</EXPLAINATION>
<QUESTIONTYPE>JAVA</QUESTIONTYPE>
</item>
<item>
<QNO>49</QNO>
<QUESTIONS>What all gets printed when the following code is compiled and run? Select the three correct answers.
public class xyz {
public static void main(String args[]) {
for(int i = 0; i < 2; i++) {
for(int j = 2; j>= 0; j--) {
if(i == j) break;
System.out.println("i=" + i + " j="+j);
}
}
}
}</QUESTIONS>
<ANSWER>35,35</ANSWER>
<OPTIONA>35,35</OPTIONA>
<OPTIONB>35,40</OPTIONB>
<OPTIONC>36,32</OPTIONC>
<OPTIOND>None of these</OPTIOND>
<EXPLAINATION>NONE</EXPLAINATION>
<QUESTIONTYPE>JAVA</QUESTIONTYPE>
</item>
<item>
<menu>
在第19行,第24列= public static void main(String args []){for(int i = 0; i&lt; 2; i ++){
答案 0 :(得分:1)
代码段包含<
,它也是启动代码的XML元字符。
将<
替换为<
或将代码包装在未解析的CDATA块中:
<![CDATA[ ... ]]>
答案 1 :(得分:-1)
i=0 j=2
i=0 j=1
i=1 j=2
; - 。)