XML file does not appear to have any style information associated with it. XHTML程序出现这个错误
程序员文章站
2022-04-26 19:06:37
...
编写xhtml代码出现错误:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<?xml version = "1.0" encoding ="UTF-8"?>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns = "http://www.w3.org/1999/en" lang= "en" xml:lang = "en">
<head>
<title>First xhtml document</title>
</head>
<body>
<div>This is <abbr title = "www.anacronym.com">an acronym</abbr> in a division.</div>
<div>This is <cite>a citation</cite> in a division.</div>
<div>This is <code>some code</code> in a division.</div>
<div>This is <em>EMPHASIZED TEXT</em> in a division.</div>
<div>This is <q>a quotation</q> in a division.</div>
<div>This is <samp>a sample</samp> in a division.</div>
<div>This is <span>a span </span> in a division.</div>
<div>This is <strong>strong text</strong> in a division.</div>
<div>This is <var>a variable name</var> in a division.</div>
<div><quot>This is a quot</quot></div>
</body>
</html>
找了半天,终于找到了,因为 <html xmlns = "http://www.w3.org/1999/en" lang= "en" xml:lang = "en">,这句错了,改为:
<html xmlns = "http://www.w3.org/1999/xhtml" lang= "en" xml:lang = "en">
改正后的代码如下:
<?xml version = "1.0" encoding ="UTF-8"?>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml" lang= "en" xml:lang = "en">
<head>
<title>First xhtml document</title>
</head>
<body>
<div>This is <abbr title = "www.anacronym.com">an acronym</abbr> in a division.</div>
<div>This is <cite>a citation</cite> in a division.</div>
<div>This is <code>some code</code> in a division.</div>
<div>This is <em>EMPHASIZED TEXT</em> in a division.</div>
<div>This is <q>a quotation</q> in a division.</div>
<div>This is <samp>a sample</samp> in a division.</div>
<div>This is <span>a span </span> in a division.</div>
<div>This is <strong>strong text</strong> in a division.</div>
<div>This is <var>a variable name</var> in a division.</div>
<div><quot>This is a quot</quot></div>
</body>
</html>
运行结果如下:
This is an acronym in a division.
This is a citation in a division.
This is some code in a division.
This is EMPHASIZED TEXT in a division.
This is a quotation in a division.
This is a sample in a division.
This is a span in a division.
This is strong text in a division.
This is a variable name in a division.
This is a quot
上一篇: CAD打开很卡该怎么办?快速提高cad运行速度的技巧
下一篇: spket 事情注意