svg question

C

chuck

Here is a trivial example using svg (from Erik Ray's book)
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG
1.1//EN" "http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd">
<svg xmlns="http://www.w3.org/2000/svg" width="500" height="500">
<desc>Three shapes</desc>
<rect fill="yellow" x="5" y="10" width="3cm" height="3cm"/>
<circle fill="orange" cx="100" cy="150" r="2cm"/>
<polygon fill="blue" points="110,160 50,300 180,290"/>

</svg>

I am thru 3 chapters of the book and what I have gathered so far is
that
a) namespaces alleviate the ambiguity when different elements have the
same name
and
b) the URI associated to the namespace is only like a placeholder-
doesn't have to mean anything.

I am trying to figure out what is in the namespace declaration that
enables the pictures to be actually drawn?
When I remove the xmlns portion, it says "
This XML file does not appear to have any style information
associated with it. The document tree is shown below." (in Firefox).

If I insert it, it displays the figures.

So what does the xmlns do in this instance?

Tx
 
M

Martin Honnen

chuck said:
<svg xmlns="http://www.w3.org/2000/svg" width="500" height="500">
<desc>Three shapes</desc>
<rect fill="yellow" x="5" y="10" width="3cm" height="3cm"/>
<circle fill="orange" cx="100" cy="150" r="2cm"/>
<polygon fill="blue" points="110,160 50,300 180,290"/>

</svg>
I am trying to figure out what is in the namespace declaration that
enables the pictures to be actually drawn?
When I remove the xmlns portion, it says "
This XML file does not appear to have any style information
associated with it. The document tree is shown below." (in Firefox).

If I insert it, it displays the figures.

So what does the xmlns do in this instance?

Firefox since version 1.5 supports SVG meaning its XML parser recognizes
elements in the SVG namespace http://www.w3.org/2000/svg and the browser
knows how to render them.
So <svg/> is simply an element with the local name 'svg' in no namespace
having no particular meaning while <svg
xmlns="http://www.w3.org/2000/svg"></svg> is recognized as belonging to
the SVG namespace.
 
C

chuck

Firefox since version 1.5 supports SVG meaning its XML parser recognizes
elements in the SVG namespacehttp://www.w3.org/2000/svgand the browser
knows how to render them.
So <svg/> is simply an element with the local name 'svg' in no namespace
having no particular meaning while <svg
xmlns="http://www.w3.org/2000/svg"></svg> is recognized as belonging to
the SVG namespace.

Got you! Thanks for the clarification.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top