svgSalamander icon indicating copy to clipboard operation
svgSalamander copied to clipboard

Out of date documentation? Trying to load inputstream and parse all elements

Open i-make-robots opened this issue 3 years ago • 5 comments

Hello!

I'm experimenting with svgSalamander as a replacement for Batik. I found this lib through a stack exchange post. I'm using the 1.0 version available in maven central. The documentation provided is not matching what I'm seeing in the API. I'd like to load an SVG from the provided InputStream, enumerate contents, and convert the elements to my custom path format. How, please?

i-make-robots avatar Mar 31 '22 21:03 i-make-robots

The latest release is 1.1.3 - you may want to grab that from the releases. The maven central repository has not been updated in some time because I've not been able to get the upload process to complete for years now. Some others have uploaded unofficial version, though.

What errors are you getting? Calling SVGUniverse.loadSVG() should load your document. What code are you using and what are the results you expect to see?

blackears avatar Apr 01 '22 10:04 blackears

I've not been able to get the upload process to complete for years now. goals! :)

What errors are you getting? the how to get started docs don't match the last maven release, there are undocumented parameters that have to be supplied. Not knowing what to put I can't even reach the compile stage.

i-make-robots avatar Apr 01 '22 15:04 i-make-robots

You need to compile using the maven build file. A language generator is run as part of the build process that generates some files.

You can also look at the examples project to get some demonstrations of how to use the library. I'm afraid your request is a bit too broad for me to answer, but if you have more specific questions about something I can try to answer that.

blackears avatar Apr 04 '22 01:04 blackears

The latest release is 1.1.3 - you may want to grab that from the releases. The maven central repository has not been updated in some time because I've not been able to get the upload process to complete for years now. Some others have uploaded unofficial version, though.

What errors are you getting? Calling SVGUniverse.loadSVG() should load your document. What code are you using and what are the results you expect to see?

Hi, I'm joining this issue. I have a local SVG file (test1.svg) which I would like to load. So, here's what I've done:

        val svgUniverse = SVGUniverse()
        val inputStream = resources.openRawResource(R.raw.test1)
        val uri = svgUniverse.loadSVG(inputStream,"test1.svg") //this is not working

Alternatively, I also tried:

        val svgUniverse = SVGUniverse()
        // imagine here some code for creating a valid URI in the following line
        val uriFromPath = URI(someStrForThisUri)
        val diagram = svgUniverse.getDiagram(javaUri, true); //this fails

This one actually fails in SVGUniverse in the following line under the else statement, throwing an exception:

                        url = xmlBase.toURL();

Which is pretty much expected to fail there.

Is there an alternative for a local resource? I would love to know about it if there is.

Thanks!

NiliStein avatar May 15 '22 19:05 NiliStein

The string you should be passing to loadSvg(Inputstream, String) is a URI that the SVGUniverse will be using to reference your document, not the name of the file. I'm not sure why svgUniverse.getDiagram(javaUri, true); isn't working. What error message are you getting? Also, if you're still having problems, it would be best to file this as a separate issue.

blackears avatar May 19 '22 16:05 blackears