XML + DTD,不会显示在浏览器中 [英] XML + DTD, won't show up in browser

查看:122
本文介绍了XML + DTD,不会显示在浏览器中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码看起来正确,可以验证,但是当我在任何浏览器中打开它时,它实际上并没有正确显示.我将首先放置XML代码,然后放置DTD代码.谢谢!

My code looks right, validates, but when I open it in any browsers it doesn''t actually show up correctly. I''ll put the XML code up first, then the DTD code. Thanks!

<!DOCTYPE slideshow SYSTEM "Lab3SlideShow6.dtd" [

<!ENTITY product "WonderWidget">
<!ENTITY products "WonderWidgets">
<!-- For singular and plural -->
<!ENTITY copyright SYSTEM "copyright.xml"> 
]> 


<!--  A sample set of slides  -->
	<!-- Entity substitutions also work in attributes -->
<slideshow title="&product; Slide Show" date="Date of publication" author="Your Name">
<!-- Insert your name here -->
<s id="embedStyle">
	* {display: inline;}
	slide, title, item { display: block; }
	s { display: none; }
	[class~=preForm] {
	display: block;
	white-space: pre;
	font-family: "Bitstream Vera Sans Mono";
	}
	item.formPre {
	display: block;
	white-space: pre;
	font-family: "Bitstream Vera Sans Mono";
	}
</s>
<!-- Processing instruction -->
<?my.presentation.Program QUERY="exec tech, all"??>
<!-- Title Slide -->
<slide type="all">
<title>Wake up to &products;!</title>
</slide>

		<!-- Copright Slide -->
		<slide type="all">
			<item>©right;</item>
		</slide>
	
		<!--    Overview    -->
		<slide type="all">
			<image src="widget.jpg" alt="Intro Pic" type="image/jpg" />
			<title>Overview</title>
			<item>Why &products; are great</item>
<item />
<item>Who buys &products;</item> 

		</slide>
		<slide type="exec">
			<title>Financial Forecast</title>
			<item>Market Size Predicted</item>
			<item>Anticipated Penetration</item>
			<item>Expected Revenues</item>
			<item>Profit Margin </item>
		</slide>
		<slide type="tech">
		<title>How it Works</title>
		<item>First we fozzle the frobmorten</item>
		<item>Then we framboze the staten</item>
		<item>Finally, we frenzle the fuznaten</item>
		<item>class="preForm">
			<![CDATA[Diagram:

					

					frobmorten <------------ fuznaten 

					| <3> ^ 
					| <1> | <1> = fozzle 
					V | <2> = framboze 
					staten--------------------+ <3> = frenzle 
									<2>
				
		</item>
		<item>In reverse, this would be</item>
		<item class="formPre">
			<![CDATA[Diagram:

					

					frobmorten ------------> fuznaten 
						^ <1> | 
						| <3> | <1> = frenzle 
						| V <2> = framboze 
						staten+-------------------- <3> = fozzle 
									<2>
									
						
			</item>
		</slide>
	</slideshow>





<!--
DTD for a simple slide show.
-->

<!ELEMENT slideshow (s, slide+)>
<!ATTLIST slideshow

title CDATA #REQUIRED

date CDATA #IMPLIED

author CDATA "unknown"

>
<!ELEMENT s (#PCDATA)>
<!ATTLIST s

id ID #IMPLIED

> 
<!ELEMENT slide (image?, title?, item*)>
<!ATTLIST slide

type (tech | exec | all) #IMPLIED

>
<!-- Defines the %inline; declaration -->
<!ENTITY % xhtml SYSTEM "xhtml.dtd">
%xhtml; 
<!ELEMENT image EMPTY>
<!ATTLIST image

alt CDATA #IMPLIED

src CDATA #REQUIRED

type CDATA "image/jpeg"

>

<!ELEMENT ss:title (#PCDATA)>
<!ATTLIST ss:title

	xmlns:ss CDATA #FIXED "http://www.rarehome.com/slideshow"

> 
<!ELEMENT item (%inline; | item)*>
<!ATTLIST item

class   CDATA #IMPLIED

type    ID    #IMPLIED

> 

<!NOTATION JPG SYSTEM "image/jpeg">
<!ENTITY theWidget SYSTEM "widget.jpg" NDATA JPG> 

>

推荐答案

帖子中的XML文本格式不正确,但这是因为您可能没有设置XML格式的属性来显示XML.您应该转义HTML<,>和& (就像我在这篇文章中所做的那样以显示这些字符).

浏览器有什么问题?无需显示doctype,不应在浏览器中显示它.不要期望CDATA会被显示-它不是逻辑结构的一部分.我怀疑它显示正确.

—SA
The XML text in your post looks not well-formed, but this is because you probably did not format it property to show XML in HTML. You should escape HTML <, >, & (as I do in this post to show these characters).

What''s looks wrong in browsers? No need to show doctype, it''s not supposed to be shown in a browser. Don''t expect CDATA to be shown — it is not a part of logical structure. I suspect it''s shown correctly.

—SA


这篇关于XML + DTD,不会显示在浏览器中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆