Scalable Vector Graphics (SVG) is an up-and-coming XML-based language used to draw vector graphics on the Web.Vector graphics are different from raster (or bitmap) graphics in that they define angles,lines, and their relationship to each other instead of simply specifying one color per pixel of an image.The result is an image that looks the same no matter what size the rendering.Vector graphic programs such as Adobe Illustrator have begun to include SVG export functions as the language gains popularity.
Although no browsers natively support SVG at present(although Mozilla 2.0 will),a number of companies, notably Adobe and Corel,are making SVG plugins that enable most browsers to display SVG graphics.
Here is a simple SVG example:
This example places a circle at the lower-right corner of a square
Note that SVG files begin with the XML prolog <?xml version=”1.0”?>,which indicates that this language is XML-based.Following that is the SVG DTD, which is optional but typically included.
The outermost tag is <svg/>, which defines the file as an SVG image.The width and height attributes can be set to anything,including percentages and pixels, but are set to 100% here for simplicity. Notice that two XML namespaces are specified, one for SVG and one for XLink. XLink defines the behavior of links such as href and will most likely be supported in future versions of XHTML.For now, SVG leads the way in supporting basic XLink.
The next tag is <desc/>, which contains a description of the image.You can think of <desc/> as being similar to the <title/> tag in HTML because it provides a description of what is in the image but does not render it on the page. Immediately following is the <defs/> tag, which is where you can define resources and shapes that are to be used later in the image. In this case,a rectangle and a circle are defined.These shapes won’t be displayed unless specifically used in the actual image.
After <defs/> is the <g/> tag, which is short for group.This <g/> is special because it is the outermost one and, therefore, encapsulates the visible image.<g/> tags can be used multiple times to form groups of shapes within the outermost <g/> (think of it as a <div/> in HTML).
In this example,two <use/> tags point to a shape in the <defs/> section.The <use/> tag points its xlink:href attribute to the ID of a shape (preceded by the pound sign, #) and, therefore, brings the shape into the visible image.Shapes defined in <defs/> can be used multiple times in the image if you include multiple <use/> tags. This capability makes SVG a shining example of code reuse among XMLbased languages.
The <script/> tag in SVG
Instead, SVG uses the xlink:href attribute to indicate an external file to reference.
In this code, the two <script/> tags are correct for SVG. The first, containing inline code, is surrounded by a CDATA section so no problems arise if you use special characters; the second uses the xlink:href attribute to reference an external file.
Tag placement in SVG
Because no <head/> area exists in SVG, <script/> tags can be placed nearly anywhere. Typically, however,they are placed:
The <script/> tag cannot be placed inside of shapes, such as <rect/> or <circle/>, nor can they be placed inside of filters, gradients, or other appearance-defining tags.
Java Script Related Tutorials
|Adv Java Tutorial||Core Java Tutorial|
|Java-Springs Tutorial||Java Servlets Tutorial|
|EJB(Enterprise JavaBeans) Tutorial||JavaServer Faces (JSF) Tutorial|
|Java Swing Tutorial||Java Tutorial|
|JavaMail API Tutorial||Java 8 Tutorial|
|Java XML Tutorial||Java Bean Utils Tutorial|
|The Java Debugger (JDB) Tutorial||Java.math Package Tutorial|
Java Script Related Interview Questions
|Java Script Interview Questions||Adv Java Interview Questions|
|Core Java Interview Questions||Java-Springs Interview Questions|
|Java Servlets Interview Questions||EJB(Enterprise JavaBeans) Interview Questions|
|JavaServer Faces (JSF) Interview Questions||Java Swing Interview Questions|
|Java 8 Interview Questions||Java XML Interview Questions|
|JavaFX Interview Questions||The Java Debugger (JDB) Interview Questions|
Java Script Related Practice Tests
|Java Script Practice Tests||Adv Java Practice Tests|
|Core Java Practice Tests||Java-Springs Practice Tests|
|Java Servlets Practice Tests||EJB(Enterprise JavaBeans) Practice Tests|
|JavaServer Faces (JSF) Practice Tests||Java 8 Practice Tests|
Java Script Tutorial
Browser And Operating System Detection
All About Events
Advanced Dom Techniques
Forms And Data Integrity
Drag And Drop
Interacting With Plugins
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.