Skip to main content

Hello everybody,

I have huge problem - working with SVG format, Im new one in work with this format. I have many questions please, how to figure it out in FME:

1.) How could I create body of SVG like this:

It means create tags <title>; <defs>; <pattern> etc.

2.) How could I put 'elem_type' attribute into <g> quotes (like above)?

3.) How could I put text content between <text> quotes without prefix CDATA, check below?

My aim is to get line like this: <text stroke=rgb(0,0,0).................................>22.11.1999</text>

Please, help me! :-)

Thanks, Lubo

Looks like a job for the XMLTemplater to me.


Looks like a job for the XMLTemplater to me.

Are You sure? Even in situation, when I need to export SVG file? And what about [cdata] - is ther any possibility, how export data without brackets please?

 

 


There is actually a SVG writer in FME, have you tried that?


There is actually a SVG writer in FME, have you tried that?

 

Good call @redgeographics, didnt know that and it looks like XML to me, hence the suggestion.
Are You sure? Even in situation, when I need to export SVG file? And what about [cdata] - is ther any possibility, how export data without brackets please?

 

 

See @redgeographics answer's below, I would try that first.

 


 

Good call @redgeographics, didnt know that and it looks like XML to me, hence the suggestion.
It is an XML flavor alright, but having a decidated writer means you don't have to worry about the inner workings of the format, that saves a lot of trouble.

 

 


It is an XML flavor alright, but having a decidated writer means you don't have to worry about the inner workings of the format, that saves a lot of trouble.

 

 

Yes I have tried SVG writer, but still have problem with body structure. When I export string values, there is everytime prefix xCDATA...]. And when I create some attributes, their values are put into brackets and all entities are at same level (check below).

 

I need structured body as I mentioned in my first contribution.

 

 

 

 


I'm no SVG expert, but I think you have to have the CDATA elements. However, if you really don't want them you can always write the SVG using the writer and then read it as text in a 2nd workspace and use a StringReplacer to get rid of the CDATA tags, then an XMLFormatter to pretty print the output.


Hi,

did you find any solutions?

I have the same problem, i need to put a <pattern> around a <path> output from svgwriter

f.e.

<pattern id="diagonalHatch" patternUnits="userSpaceOnUse" width="4" height="4">

<path d="M-1,1 l2,-2

M0,4 l4,-4

M3,5 l2,-2"

style="stroke:black; stroke-width:1" />

</pattern>


Hi,

did you find any solutions?

I have the same problem, i need to put a <pattern> around a <path> output from svgwriter

f.e.

<pattern id="diagonalHatch" patternUnits="userSpaceOnUse" width="4" height="4">

<path d="M-1,1 l2,-2

M0,4 l4,-4

M3,5 l2,-2"

style="stroke:black; stroke-width:1" />

</pattern>

Hello @sebastiangoerck,

finally, I had to leave SVG writer and I used XMLTemplater - Its better for my purposes (I have free hands in creating of template for our customer). The hardest thing was to find way, how to convert geometries to SVG, but combination of expressionevaluators and geometryextractor can do that.

Hope I helped You!

Lubo


Hello @sebastiangoerck,

finally, I had to leave SVG writer and I used XMLTemplater - Its better for my purposes (I have free hands in creating of template for our customer). The hardest thing was to find way, how to convert geometries to SVG, but combination of expressionevaluators and geometryextractor can do that.

Hope I helped You!

Lubo

thanks for the feedback...this is not the solution i had hoped for, but i will have a look at it :-)


@lazarlubomir

Did you try using the pre-defined template in SVG Writer Parameter?

FME SVG Writer

hope that helps

happy fme-ing :-)

srg


@lazarlubomir

Did you try using the pre-defined template in SVG Writer Parameter?

FME SVG Writer

hope that helps

happy fme-ing :-)

srg

i miss the approach at this Point, an example would be very helpful.

:-)


 Hi @lazarlubomir, unfortunately, there is currently no support in FME Desktop to accomplish this through SVG Writer. But doing some post-processing with XMLFragmentor and XMLQueryUpdator 

 

Here is how workflow would go

 

Transform your file to SVGWriter Directly

 

Now using FeatureReader, Read back the file and use the above-mentioned transformers

For XMLQueryUpdator use following syntax 

NOTE: this is just sample add the tags as you desire 

declare namespace x='http://www.w3.org/2000/svg';
for $n in /x:g
return
insert node attribute elem_type{'elem_id'} into $n

0684Q00000ArK5iQAF.png

Please find attached a sample workflow. 

none2svg_2018.fmw


Reply