Nested SVG

199 views
Skip to first unread message

Ms.Ranjan

unread,
Sep 8, 2010, 3:38:37 PM9/8/10
to SVG Web
Hi All,

I am trying to use SVGWeb toolkit into my application. The format of
my svg code is like this

<?xml-stylesheet href="styles/sty.css" type="text/css" ?>
<svg id ="name1" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" >

<svg id="name2">
</svg>

<svg id="name3">
</svg>

</svg>

the error that I get is
XML Parsing Error: junk after document element
Location: http://localhost:8080/appname
Line Number 21, Column 1:
<svg id ="name1"
^
The reason for this error as far I know is if there are two or more
root elements instead of one top level element this error will occur.
Does the svg tag inside another svg tag considered as two top level
elements, is that why I am getting this error? Can someone please
help me?

Thanks

mykhel

unread,
Sep 15, 2010, 1:38:01 PM9/15/10
to SVG Web
Your xml format is wrong. Please use this format:
<svg>
<svgs id="name2"> </svgs>
<svgs id="name2"> </svgs>
<svg>

your nodes should have different tag name. your main tag name is "svg"
you should select another name for your nodes. hope this could help.

- mykhel

Jeff Schiller

unread,
Sep 15, 2010, 3:48:53 PM9/15/10
to svg...@googlegroups.com
Ms. Ranjan, I believe the problem is that you're trying to use an external stylesheet, and this is not supported yet by SVG Web.  Follow bug #365: http://code.google.com/p/svgweb/issues/detail?id=365

mykhel, your advice is incorrect.  SVG allows nested <svg> elements within it.  There is no such tag as 'svgs'.

Regards,
Jeff

--
You received this message because you are subscribed to the Google Groups "SVG Web" group.
To post to this group, send email to svg...@googlegroups.com.
To unsubscribe from this group, send email to svg-web+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/svg-web?hl=en.


Rick Masters

unread,
Sep 15, 2010, 3:49:56 PM9/15/10
to SVG Web

I appreciate the attempt to help, but I do not think the suggested
syntax will work. "svgs" is an invalid tag name.

There should be no problem with nested svg elements. I use them all
the time. The problem is likely somewhere else.

I think we'd need to see how the SVG was incorporated into the web
page to provide help.

I'm not familiar with the form of xml tag used at the beginning. If I
recall correctly, the syntax is typically like so: <?xml version="1.0"?
> I am not saying the tag is incorrect. It may be correct but SVG Web
may not like it. This is speculation. The problem may be somewhere
else entirely.

Rick
> > Thanks- Hide quoted text -
>
> - Show quoted text -

Ms.Ranjan

unread,
Sep 20, 2010, 9:59:12 AM9/20/10
to SVG Web
Thank you all for your help. Thanks Jeff for pointing out the issue.
Rick to answer your question.

<%@ page contentType="image/svg+xml" %>

<HTML>
<head>
<meta name="svg.render.forceflash" content="true"/>
<script src="src/svg.js" data-path="src" data-htc-filename="src/svg-
htc.jsp"></script>
</head>
</HTML>

<?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">

<?xml-stylesheet href="styles/sty.css" type="text/css" ?>
<svg id ="name" >

This is how I incoporate SVG into my jsp page. I always get the XML
Parsing Error.

Thanks

Ms.Ranjan

unread,
Sep 20, 2010, 12:15:46 PM9/20/10
to SVG Web
Only difference is the place where the error on the line is pointed
out, when I comment out
<!--<?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"> -->

The xml parsing error points out to this line
<svg id ="name" >
^

otherwise the parsing error shows the line
<?xml version="1.0" standalone="no"?
^

Jeff Schiller

unread,
Sep 20, 2010, 12:20:31 PM9/20/10
to svg...@googlegroups.com
You need to remove the xml-stylesheet line.

You need to include xmlns='http://www.w3.org/2000/svg' in your <svg> element.

Jeff

^

Ms.Ranjan

unread,
Sep 20, 2010, 12:56:16 PM9/20/10
to SVG Web
<?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">

<!-- <?xml-stylesheet href="styles/sty.css" type="text/css" ?> -->

<svg id ="name" width="100%" height="100%"
preserveAspectRatio="xMinYMin meet"
version="1.1" onload="call()">

Removing the stylesheet line and including xmlns still gives me the
same error.

Thanks Jeff

Bradley Neuberg

unread,
Sep 29, 2010, 1:12:18 PM9/29/10
to svg...@googlegroups.com
Hmm, SVG Web should be able to parse the nested <svg> elements at least, since this old issue is closed:


Sometimes there can be hidden control characters that can cause an XML parser to barf. Can you go into your editor and turn on "See Invisibles" to see if maybe there is a strange character?

Also, it wasn't clear to me if the SVG parsing was failing during Flash mode in SVG Web or by the native SVG renderer.

Best,
  Brad Neuberg





--
Reply all
Reply to author
Forward
0 new messages