当前位置: 首页 > 网络学院 > XML相关教程 > XML > 浏览 XML 文件

XML
XML DHTML行为
XML 相关技术
XML 编辑器
XML 摘要
XML 实例
XML字符编码
xml 文档树
IE和火狐读取XML方法比较

浏览 XML 文件


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 1039 ::
收藏到网摘: n/a

Raw XML files can be viewed in Mozilla, Firefox, Opera, Internet Explorer, and Netscape 6+.
原始的XML的文件可以在Mozilla Firefox、Opera、Internet Explorer 和 Netscape 6+ 中浏览。

However, to make XML documents display as nice web pages, you will have to add some display information.
然而,为了让XML文档显示出漂亮的网页,你必须添加一些显示信息。


Viewing XML Files
浏览XML文件

In Firefox and Internet Explorer:
在 Firefox 和 Internet Explorer 中浏览:

Open the XML file (typically by clicking on a link) - The XML document will be displayed with color-coded root and child elements. A plus (+) or minus sign (-) to the left of the elements can be clicked to expand or collapse the element structure. To view the raw XML source (without the + and - signs), select "View Page Source" or "View Source" from the browser menu.
打开XML文件(一般就是点击一下链接)——XML文档中显示的根目录和子目录是由彩色标记的,点击目录左边的加(+)减(-)号,可以展开收回目录结构。选择浏览器菜单上的“页面源代码”("View Page Source")或“源文件”( "View Source")

In Netscape 6:
在Netscape 6浏览:

Open the XML file, then right-click in XML file and select "View Page Source". The XML document will then be displayed with color-coded root and child elements.
打开XML文件,右击XML文件,选择“源文件”。出现的将是有显示彩色标记的根子目录的XML文档。

In Opera 7 and 8:
在Opera 7 and 8浏览:

In Opera 7: Open the XML file, then right-click in XML file and select "Frame" / "View Source". The XML document will be displayed as plain text. In Opera 8: Open the XML file, then right-click in XML file and select "Source". The XML document will be displayed as plain text.
在Opera 7上: 打开XML文件,右击XML文件,选择“框架”/“浏览资源”("Frame" / "View Source")。XML文档将以普通文本显示。在Opera 8: 打开XML文件,右击XML文件,选择“资源”("Source”)。XML文档将以普通文本显示

Look at this XML file: note.xml
看这份XML文件:: note.xml

Note: Do not expect XML files to be formatted like HTML documents!
Note: 可别指望XML文件会像HTML文件一样布局。


Viewing an Invalid XML File
浏览一份残缺的XML文件

If an erroneous XML file is opened, the browser will report the error.
如果打开一份有错的XML文件,浏览器会报告错误信息。

Look at this XML file: note_error.xml
看这份: note_error.xml


Other XML Examples
其它XML的案例

Viewing some XML documents will help you get the XML feeling.
浏览一些XML文档可以帮你找到一点“XML感觉”。

An XML CD catalog
This is my father's CD collection, stored as XML data (old and boring titles I guess... :-)).
一份CD名录的XML文件
这是以XML的数据形式存储的父亲的CD集(我想这些歌名又老又乏味:))

An XML plant catalog
This is a plant catalog from a plant shop, stored as XML data.
一份植物名录的XML文件
这是以XML的数据形式存储的来自花卉商店中的植物名录。

A Simple Food Menu
This is a breakfast food menu from a restaurant, stored as XML data.
简单的食物菜单
这是以XML的数据形式存储的来自餐馆的早点菜单。


Why Does XML Display Like This?
为什么XML文件是这样显示的?

XML documents do not carry information about how to display the data.
XML文档并没有包含关于数据显示样式的信息。

Since XML tags are "invented" by the author of the XML document, browsers do not know if a tag like <table> describes an HTML table or a dining table.
因为XML标签是作者自定义的,浏览器并不知道这个标签该如何显示,如:浏览器不知道这里的<table> 描述的是“HTML 表格”(HTML table),还是“餐桌”(dining table)。

Without any information about how to display the data, most browsers will just display the XML document as it is.
因为XML中并没有包含XML 数据的显示信息,所以大多数浏览器只会显示最初的XML文档。

In the next chapters, we will take a look at different solutions to the display problem, using CSS, XSL, JavaScript, and XML Data Islands.
在下面几章里,我们会学习解决显示问题的一些不同方法,如使用CSS、 XSL、 JavaScript  和 XML 数据岛。

评论 (0) All

登陆 | 还没注册?