Loganathan Sarangan
Loganathan Sarangan

Reputation: 181

Conversion from SVG file to XML file

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

Upvotes: 18

Views: 46231

Answers (5)

CoolMind
CoolMind

Reputation: 28793

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

Upvotes: 23

mannjon
mannjon

Reputation: 9

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.

Upvotes: 0

Prakazh Kumar
Prakazh Kumar

Reputation: 41

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.

Upvotes: 3

xmojmr
xmojmr

Reputation: 8145

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

Upvotes: 4

Geert Bellekens
Geert Bellekens

Reputation: 13720

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.

Upvotes: 2

Related Questions