You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Fr...@idi.ntnu.no on 2005/03/23 17:09:21 UTC

svg attributes removed during parsing

Hi!

I'm having problem with attributes being removed during the svg-as-xml to
SVGDocument parsing-process. The code below is used to create the
SVGDocument from a String containing the svg in xml format. The attribute
"marker-end" for tag "path" is lost (it isn't there when I serialize and
print the SVGDocument) (example below).

It works ok when Batik takes care of the parsing (calling
svgcanvas.loadSVGDocument(someUrl) )

Any ideas?

Sincerely,

Fredrik

---

Text in string:
--------------------
...
<path marker-end=\"url(#triangel)\" d=\"M 50 50 L 70 120\"/>
...

Parse code:
-----------
SAXSVGDocumentFactory ssdf = new
SAXSVGDocumentFactory(XMLResourceDescriptor.getXMLParserClassName());
anSVGDocument = (SVGDocument)ssdf.createSVGDocument(null,new
StringReader(xmlSvg));

Text when serializing and printing the SVGDocument:
---------------------------------------------------
...
<path d=\"M 50 50 L 70 120\"/>
...


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: svg attributes removed during parsing

Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Fredik,

Fredrik.Medby.Hagen@idi.ntnu.no wrote:

> I'm having problem with attributes being removed during the svg-as-xml to
> SVGDocument parsing-process. The code below is used to create the
> SVGDocument from a String containing the svg in xml format. The attribute
> "marker-end" for tag "path" is lost (it isn't there when I serialize and
> print the SVGDocument) (example below).

    I can assure you that we don't randomly eat attributes ;)

    I would simply the document so you can make sure that
you don't have something silly like two copies of the
same element that might be confused when you serialize.

    Also the order of attributes might change so when you
write it out the marker-end attribute might be after the
'd' attribute which could be large.

> <path marker-end=\"url(#triangel)\" d=\"M 50 50 L 70 120\"/>

> Text when serializing and printing the SVGDocument:
> ---------------------------------------------------
> ...
> <path d=\"M 50 50 L 70 120\"/>

> Parse code:
> -----------
> SAXSVGDocumentFactory ssdf = new
> SAXSVGDocumentFactory(XMLResourceDescriptor.getXMLParserClassName());
> anSVGDocument = (SVGDocument)ssdf.createSVGDocument(null,new
> StringReader(xmlSvg));

    I don't see anything wrong here.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org