My first xml file for SVG:)

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
   "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg width="300" height="300">

    
<rect x="50" y="50" width="200" height="200" style="fill:none;stroke:black;stroke-width:2;"></rect>
    
<line x1="50" y1="180" x2="230" y2="50" style="stroke:black;stroke-width:2;"></line>
    
<line x1="80" y1="250" x2="244" y2="50" style="stroke:black;stroke-width:2;"></line>
    
<circle cx="172" cy="123" r="8" style="fill:none;stroke:black;stroke-width:2;"></circle>
</svg>
    
这是我用xml语言编辑的第一个SVG(可伸缩向量图形)文件(svg0.svg),效果图为:


感觉很有趣吧?呵呵

补充:
1 There are three ways of defining SVG in a Web document:

as a standalone SVG page (如上)
as an embedded element (如下)
in an XHTML document with a namespace declaration (后续)

   <!--svg0.svg is embedded element in a XHTML document (svg.html )-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
>

<html>
<body>
<object data="svg0.svg" width="500"
height
="500" type="image/svg+xml">
<!--According to the XHTML standard we should only use the &lt;object&gt ;
   tag,but since Netscape does not support this tag,  it's best to use both the 
   &lt;object &gt; and &lt;embed &gt;tags.
-->

<embed src="svg0.svg" width="500"
height
="500" type="image/svg+xml" />
</object>
</body>
</html>

2 SVG's predefined shape elements:

Rectangle <rect> 矩形
Circle <circle> 圆
Ellipse <ellipse> 椭圆
Line <line> 直线
Polyline <polyline> 折线
Polygon <polygon> 多边形
Path <path> 路径

3 The namespace for SVG(xmlns):    http://www.w3.org/2000/svg
Public Identifier for SVG 1.1:    PUBLIC "-//W3C//DTD SVG 1.1//EN"
System Identifier for the SVG 1.1 Recommendation:   
http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd

4 The namespace for XHTML(xmlns) :  http://www.w3.org/1999/xhtml
DOCTYPE declaration :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

http://www.w3.org/TR/SVG/
http://www.w3.org/TR/2001/REC-xhtml11-20010531/
posted on 2004-08-10 18:25  9yue  阅读(547)  评论(0)    收藏  举报