svg question

Discussion in 'XML' started by chuck, Oct 19, 2007.

  1. chuck

    chuck Guest

    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
     
    chuck, Oct 19, 2007
    #1
    1. Advertising

  2. chuck wrote:

    > <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.



    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Oct 19, 2007
    #2
    1. Advertising

  3. chuck

    chuck Guest

    On Oct 19, 9:22 am, Martin Honnen <> wrote:
    > chuck wrote:
    > > <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 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.
    >
    > --
    >
    > Martin Honnen
    > http://JavaScript.FAQTs.com/


    Got you! Thanks for the clarification.
     
    chuck, Oct 19, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arne Nordmann
    Replies:
    0
    Views:
    527
    Arne Nordmann
    Jun 28, 2004
  2. Mardagg
    Replies:
    0
    Views:
    809
    Mardagg
    May 12, 2006
  3. Mardagg
    Replies:
    0
    Views:
    668
    Mardagg
    May 12, 2006
  4. milof83

    svg to svg saving problem

    milof83, Aug 18, 2006, in forum: Java
    Replies:
    1
    Views:
    833
    Roland de Ruiter
    Aug 18, 2006
  5. Helmut Jarausch

    Re: svg-chart 1.1 SVG Charting Library

    Helmut Jarausch, May 20, 2008, in forum: Python
    Replies:
    0
    Views:
    473
    Helmut Jarausch
    May 20, 2008
Loading...

Share This Page