当前位置: 首页 > 网络学院 > 设计教程 > 设计理念 > 什么是XML Schema

设计理念
利用.htaccess控制网站
别具一格的网站评论
网站设计原理

设计理念 中的 什么是XML Schema


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

It used to take me 10 minutes to design a web site. When I began designing web sites back in 1996, the process was very simple. I would ask the person who had requested the web site to put all of their content into a Microsoft Word file and email it to me. I would copy and paste that content into FrontPage or a text editor, insert some HTML tags to create the layout, add some graphics for style and I was finished.

我通常花10分钟就可以设计一个网站。我在1996年开始从事网站设计,当时的设计过程非常简单。我询问我的客户,让他把网站内容写在word里,然后用email发给我。收到邮件后,我把word中的内容复制到FrontPage[一种微软开发的网页可视化编辑器]或文本编辑器中,然后在里面插入一些HTML标签来创建布局,接着添加一些用于表现网站风格的图片,这样就完成了整个网页设计。

The platforms and web browsers being used on wireless products are different from an ordinary desktop PC. These new systems are not fully compatible with many elements of the HTML programming language. As a result, websites created exclusively with HTML are often invisible or inaccessible to the wireless user.

在无线产品中使用的操作平台和网络浏览器与原始的桌面个人电脑是完全不同的。这些新系统不能和HTML编程语言的每个元素完全兼容。这种情况导致的结果就是,创建网站所专用的HTML对于无线用户来说通常是不可视的或不可访问的。

The programming community responded by creating cross-platform compatible languages and specifications for creating web sites so that all sites could be viewed equally, or at least close to equally, on all web browsers. A language called XML was created to define data without telling the browser how to display it. HTML forced the browser to display data a certain way. XML defined data without telling the browser how to display it because XML was a simple text file. Thus, data created with XML could be viewed on any machine, computer, or browser. Then, specifications such as XHTML and XSL were developed in order to turn XML files into web pages that had style and structure, and more importantly, could be viewed and interpreted across all platforms, wireless or not.

编程协会通过创建与各种程序语言相互兼容的交互式平台以及将网站创建的规格进行统一,使得每个浏览器中显示的网站看上去是完全一样的或是近似一样的。XML语言可以用于定义数据,并且它不用告诉浏览器以什么方式来显示这些数据。HTML迫使浏览器以一种特定的方式显示数据。而XML并不规定浏览器显示数据的方式,主要是因为XML仅是一个简单的文本。然而,通过XML创建的数据可以在任何的机器、电脑或浏览器上浏览。此时,诸如XHTMLXSL规格也随之发展起来,它的目的是将XML文件转变为样式化和结构化的网页,并且,更重要的一点是,它可以在所有的平台上展示,不管是有线设备还是无线设备。

Now that you understand how and why web design has changed, you are ready to learn about the main topic of this article, XML Schema. XML Schema is a specification that enables a programmer to describe the structure of an XML document. Programmers used to rely on Document Type Definition (DTD) to structure their XML documents, but XML Schema is now seen as the permanent replacement for DTD.

既然你已经知道了现在的网站设计已经不再像以前那样了,那么,接下来,让我们开始学习我们的主题——XML SchemaXML Schema 是用来描述XML文档结构的一种规范。程序设计师过去常常依赖“(DTD)Document Type Definition:文本类型定义”来定义XML文档结构,但是在现在,XML Schema
已经完全替代了DTD的位置。

XML Schema was initially introduced by Microsoft, and was later endorsed and adopted by the World Wide Web Consortium (W3). XML Schemas ensure that data can be communicated in a format that is universal. For example, different countries use different formats to display the date. Some countries put the month first, others put the day first, and some put the year first. The XML Schema for date requires that all dates be in YYYY-MM-DD format. Thus, everyone viewing XML data knows what the data is because they know it is written in XML Schema.

XML Schema
是微软首先推介的,在此之后,它被“(W3C)World Wide Web Consortium:万维网联盟”所认可和采纳。XML Schema确保数据以一个通用的格式进行交流。举个例子来说,不同的国家使用的是不同的日期显示格式。有些国家习惯把“月”放在开头,有些则习惯把“日”放在开头,还有些则习惯把“年”放在开头。XML Schema则要求所有的日期格式都是:YYYY-MM-DD[年(四位)—月(两位)—日(两位)]。这样一来,每个人在浏览XML数据时,都可以清楚地知道这个数据指的是什么。因为,它们都是遵循XML Schema标准书写的。

XML Schema has a lot of built-in data types for defining data. To define data, XML Schema uses attributes. XML Schema attributes are somewhat similar to HTML attributes in that they are included within a tag, and the attribute further defines the tag. With HTML, an image tag would have a source attribute to provide the name of the file that contains the image to be displayed. Another example of an HTML attribute would be an alignment attribute within a paragraph tag that stipulates whether the paragraph should be aligned to the left or right. Examples of XML Schema attributes for describing data are string, decimal, boolean, integer, date, and time.

XML Schema
包含了大部分用于定义数据的内置数据类型。XML Schema通过属性来定义数据。XML Schema属性有些类似于HTML的属性。在定义XML Schema属性时,属性都是写在标签内的,并且,属性能够深度定义标签。在HTML中,一个图像标签内必须包含图像所在的文件名及其具体的来源地址,这样才能显示该图像。HTML属性的另外一个例子就是段落标签中的对齐属性,它指定段落是遵循左对齐还是右对齐。XML Schema中的属性则是用于描述数据类型的,如:字符串、十进制数、逻辑值、整数、
日期和时间。

One of the most important features of XML Schema is that it is replete with many different built-in restrictions that can be imposed on all data so that data is consistently displayed a certain way or presented in a certain format. Using XML Schema restrictions, a programmer can impose limits on upper or lower bounds for ranges of numbers, the length of numbers or the length of lists of items, and XML Schemas can even be used to define how white space is handled (tabs, line feeds, etc.).

XML Schema
的其中一个重要属性就是他的内置限定。这些内置限定可以对所有的数据加以利用,从而使这些数据保持固定的显示方式和存在方式。通过使用XML Schema限定,程序设计师可以对数值的范围和长度以及项目的列表长度进行限定,并且,XML Schema甚至可以用以定义空白空间的处理方式(制表符,换行符等)。

XML Schema and XML programming are not easy to learn. You might want to start by searching for some basic online tutorials, but if web design is your full-time profession, you should instead enroll in some courses offline at a local college or computer programming institute. If you do not make use of versatile languages such as XML, XSL, and XHTML, your website might be invisible to those who surf the web on wireless devices, and you might be putting your career as a web designer in jeopardy.

学习XML SchemaXML程序并不轻松。你可以寻找一些在线基础教程。但是,如果网页设计是你的专业,你应该参加一些本地大学或电脑编程学校所开设的相关课程。如果你不会使用这些通用语言,如:XMLXSL以及XHTML,那么,你设计出来的网页对于那些通过无线设备上网的人来说,可能根本无法浏览,这将会使你的职业陷入危险的境地。

评论 (0) All

登陆 | 还没注册?