本站遵循的SVG页面编写标准

作者:Eureka 撰稿时间:2005-03-12

SVG文档的编写遵循SVG1.1标准:

说明:本站的所有文档附合xml要求,满足SVG1.1标准。有些文档参考svg1.2并做到向后兼容,对于特殊需要的地方使用svg1.0标准。

更详细标准参见:w3c之svg标准

SVG文字编码标准统一使用unicode 之utf-8

说明:为了使所有页面都能在所有国家正常显示,本站统一使用unicode作为字符集,并采用utf-8作为文字编码方式。虽然当前有些系统(如win98)和浏览器可能不支持utf-8,但相信以后大家都能看到用该方式编码的文档。

unicode信息参见:unicdoe网站:unicode.org及本站所采用的unicode标准

utf-8信息参见:utf-8.com 及本站所采用的utf-8标准

使用CSS标准:

说明:本站html主要用来表示内容而不用html去表示表示层的东西。表示层统一用CSS表示,一般也不使用表格即<table><td><tr>之类的标签进行布局。当前使用的标准以满足CSS1.0为主,满足 CSS2.0为辅,并适当参考CSS3.0。

CSS标准参见W3C制定的:CSS标准

SVG头部代码标准:

简单型:

把CSS Style定义在文件或图形元素里面,不另外使用xmlns来定义metadat等:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="600" height="600" viewbox="0 0 1200 1200" version="1.1" xmlns="http://www.w3.org/2000/svg">
  <title>该SVG文件来自于http://eeeeee.org</title>
  <desc>描述该图形及其它各种内容
    <style type="text/css"><![CDATA[
      somecssstyle {
      fill: red;
      stroke: blue; 3
      }
    ]]></style>
     
</desc>

复杂型:

引用外部CSS Style,以及定义metadata的各种内容:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<?xml-stylesheet href="http://www.eeeeee.org/stylesheets/svg.css" type="text/css"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="600" height="600" viewbox="0 0 600 600"version="1.1" xmlns="http://www.w3.org/2000/svg">
<!--标题和文档的描述-->
  <title>该SVG文件来自于http://eeeeee.org</title>
  <desc>描述该图形及其它各种内容   
  
</desc>
<!--该文档的元数据,描述图片相关信息和版权-->
  <metadata>
    <rdf:RDF xmlns:rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:rdfs = "http://www.w3.org/2000/01/rdf-schema#"
             xmlns:dc = "http://purl.org/dc/elements/1.1/"
             xmlns:cc="http://web.resource.org/cc/" >
      <rdf:Description about="http://eeeeee.org/myfoo" >
        <dc:title>易易SVG图片</dc:title>
        <dc:description>描述易易图片</dc:description>
        <dc:date>2006-01-01</dc:date>
        <dc:format>image/svg+xml</dc:format>
        <dc:creator>陈耀军(Eureka Chen) </dc:creator>
      </rdf:Description>
<!--版权信息,按:http://creativecommons.org/licenses/by-nc-sa/2.0/ -->
      <cc:License rdf:about="http://creativecommons.org/licenses/by/2.0/">
        <cc:permits rdf:resource="http://web.resource.org/cc/Reproduction" />
        <cc:permits rdf:resource="http://web.resource.org/cc/Distribution" />
        <cc:requires rdf:resource="http://web.resource.org/cc/Notice" />
        <cc:requires rdf:resource="http://web.resource.org/cc/Attribution" />
        <cc:prohibits rdf:resource="http://web.resource.org/cc/CommercialUse" />
        <cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
        <cc:requires rdf:resource="http://web.resource.org/cc/ShareAlike" />
      </cc:License>      
    </rdf:RDF>
</metadata>
<!--正式文档开始-->

说明:考虑当前浏览器及程序的实际支持情况(如webdraw1),当前采用简化的SVG头部如下,并且直接在元素里使用Style而不用<style>标签,因为程序往往还不支持:

<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="300" height="300" viewBox="0 0 300 300" >
  <title>该SVG文件来自于http://eeeeee.org</title>
  <desc>描述该图形及其它各种内容   
  
</desc>
  


本站SVG tidy设置:(按字母顺序)

本站的SVG编写风格和参照html编写标准进行。只改动ouput-xml input-xml output-xml选项。详细说明亦参照html编写标准

alt-text: "e"
bare: no
char-encoding:raw
clean: yes
css-prefix: ee
doctype:strict
drop-font-tags: yes
drop-proprietary-attributes: yes
fix-uri:no
indent:yes
indent-attributes:no
indent-cdata: yes
indent-spaces: 2
input-encoding:raw
input-xml: yes
join-classes:yes
join-styles:yes
logical-emphasis:yes
output-xml:yes
punctuation-wrap:no
quote-marks:no
quote-nbsp:yes
tidy-mark:no
vertical-space:yes
word-2000:yes
wrap:0
wrap-php:no

该标准将将output-xml改为output-xhtml,把input-xml改为no则可用在xhtml文档的格式化。

XHTML1.1   CSS   CC   CC中文   直接打印   易易工作室   易网