运行xml时出现XML错误

时间:2011-06-11 16:46:26

标签: xml

有人可以让我知道我做错了吗

 The XML page cannot be displayed 
 Cannot view XML input using style sheet. 
 Please correct the error and then click the efresh       
 Button, or try again later. 


A name contained an invalid character. 
Error processing resource 
'file:///C:/Users/Randy/Desktop/faq.xml'. Line 1, Positio...

<?xmlversion"1.0"?encoding="UTF-8" standalone="yes"?>
------------^

<?xml version="1.0"? encoding="UTF-8" standalone="yes"?>
"ScanMaster and DigiCam FAQ"
"Randy White 6/11/2011"
<FAQ>
/*
 New Perspectives on XML
 Tutorial 1
 Case Problem 1
 Filename: faq.css

This file contains styles used in the faq.xml file.

 */
 </FAQ>
 FAQ      {margin-top: 10px}
 title    {display: block; width: 500px; font-family: Arial, Helvetica, Sans-serif; 
      font-size: 18pt;
      margin-left: 20px}

 subtitle {display: block; width: 500px; font-family: Arial, Helvetica, Sans-serf; 
      font-size:14pt; font-style:italic;
      margin-left: 20px}

 product  {display: block; width: 500px; background-color: ivory;
      border: solid 2px black; margin-bottom: 20px; padding: 10px;
      margin-left: 10px}

 model    {display: block; width: 500px; font-family: Arial, Helvertica, Sans-serif; 
      font-size: 14pt; color:blue;
      margin-left: 10px; margin-top: 5px}

 question {display: list-item; list-style-type: disc; width: 500px;
      margin-left: 30px; margin-top: 10px}

 answer   {display:block; width: 450px; font-family: Times New Roman, Times, Serif;
      color: green;
      margin-left: 35px}

4 个答案:

答案 0 :(得分:1)

encoding之前不应该有问号。

也可能是该行中的一个空格实际上是一个不间断的空格,字符代码&#xA0;,而不是常规空格&#x20;

答案 1 :(得分:1)

用这一行替换第一行。你会看到差异。空格和=缺失。

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

答案 2 :(得分:0)

关于你现在得到的错误...... 您的文档格式不是格式良好的XML,因为顶级元素(<FAQ>)之外不应该有文本内容。您有文本内容,例如

"ScanMaster and DigiCam FAQ"

在顶级元素之前,文本内容如

FAQ      {margin-top: 10px}

之后。

在XML文档中,顶级元素之外允许的唯一类型的节点是注释和处理指令。 (当然是序幕,但那不是节点。)

答案 3 :(得分:0)

如果您修改单词中的原始 XML ,然后将其复制并保存在word中。使用Unicode文本文档选项保存文本文档而不保存其他选项,如富文本格式。使用Unicode文本文档选项删除我们在单词中完成的所有格式。