Conversion from SVG file to XML file
Asked Answered
G

5

18

Can you explain how to convert SVG files to XML files?

I am having design tool(EB guide) which generates SVG file format (contains state diagram). I need to use this SVG file in order to view the state diagram in Enterprise architect UML tool.

But, EA tool is not supporting SVG file. so i try to convert SVG file into xml file and then import in to EA tool.

Is it possible to convert this SVG file format in to XML file format? is there any conversion tool available.

logu

Grimm answered 27/11, 2014 at 6:49 Comment(0)
C
23

1) In Android Studio press File > New > Vector Asset. Select SVG file in Path.

enter image description here

You will get a new XML file in drawables folder.

Or you can use these methods.

2) http://inloop.github.io/svg2android/

3) http://a-student.github.io/SvgToVectorDrawableConverter.Web/ with checkbox "Specify --fix-fill-type".

Cockeye answered 2/10, 2017 at 14:58 Comment(0)
W
4

SVG file is already in XML format. But it describes a picture. You can use a graphic programs to convert it to other picture formats, e.g. BMP, PNG which can be then inserted as an Image element into your diagram drawing canvas. (See also chapter "Using the Image Manager" in the help file)

The XML file which can be imported into your EA model using the XMI Import and Export tool must contain an UML model in the XMI format, not just a picture or a printscreen

Whoremaster answered 27/11, 2014 at 7:31 Comment(0)
M
3

You can use Android Development Studio (Version >1.4):-

-Create a project

-In any of the folder inside resource folder, right click and choose option 'New', in that choose 'Vector Asset'.

To use svg in android application it is required to be converted into xml.

Android will automatically convert your svg to xml, and you can get your xml file from resource folder.

Moureaux answered 10/8, 2016 at 6:38 Comment(0)
E
2

No that won't be possible. SVG is a graphics format, so it only contains information about image of your diagram, not about the contents of the UML model it represents. It doesn't know about UML, so you'll never be able to use that as a format to import something into EA.

What you need is an XMI file. XMI is the standard for UML models interchange. Check the documentation of your design tool to find out if there is an XMI export facility.

Etherify answered 27/11, 2014 at 7:27 Comment(2)
SVG is XML. It's merely rendered as a graphic.Torres
@Torres The way that is is stored isn't relevant in this case. (xmi is xml as well). It is the type of information that is stored that is relevant. SVG -> graphics, XMI -> UML ModelEtherify
K
0

If anyone is still wondering about this...

As long as the SVG file is a true vector-based SVG file (meaning it contains no rasterized art), it is not just a graphics file, but retains the original paths associated with the vector object including colors, gradients, and other complex information.

If you can use path tools, I recommend a free open-source tool called Inkscape. It allows you to import a vector-based SVG file and export to XAML paths.

But this will only work if your diagram is in a true vector format.

Kirtle answered 8/10, 2018 at 20:41 Comment(1)
does Inkscape require a subscription to do the conversion ?Crump

© 2022 - 2024 — McMap. All rights reserved.