Link to home
Start Free TrialLog in
Avatar of DJ_AM_Juicebox
DJ_AM_Juicebox

asked on

Question about namespaces?

Hi,

I'm trying to use "xlink:href" within an html document, but I'm not sure how to use this. I'm trying to display an <svg> element, here's my code:

<html>
<body>
    <svg
      width="800px"
      height="500px"
      xmlns="http://www.w3.org/2000/svg"
      xmlns:xlink="http://www.w3.org/1999/xlink">

      <ellipse cx="100" cy="100" rx="20">
         <animateMotion dur="40s" >
                <mpath xlink:href="#curve"/>   // <-- Problem
         </animateMotion>
      </ellipse>
  </svg>
</body>
</html>

yeah so my browser won't load the page, saying:

  XML self-closing tag syntax used on <mpath>. The tag will not be closed.

the <svg> element is originally taken from a .svg file, I want to put it into this .html file. What's the right way to reference it?

Thanks
Avatar of DJ_AM_Juicebox
DJ_AM_Juicebox

ASKER

Oh it looks like the error is telling me I can't use the shorthand close-tag notation. So this is an error:

  <mpath xlink:href="#curve"/>

but this parses fine:

  <mpath xlink:href="#curve"></mpath>

is there a way to tell the browser to expect the shorter-notation? Otherwise I have to always add these extra tags.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of SleepinDevil
SleepinDevil

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial