jgraph / svg2xml

SVG to XML mxGraph stencil definition translation tool
Apache License 2.0
63 stars 40 forks source link

Start but nothing happens #11

Closed spyderweb56 closed 6 years ago

spyderweb56 commented 6 years ago

Terminal sits at "parsing Blog using 0 configs" even though I have some things checked.

alexstulov commented 6 years ago

Hello. I've successfully installed and run package as written in readme.md. I pick .svg file, set destination folder, click start.

And I see this: `java -classpath lib/mxgraph-core.jar:classes com.mxgraph.svg2xml.Svg2XmlGui

parsing add using 0 configs

parsing arrow_dwn using 0 configs

parsing flagbe using 0 configs

parsing key_1 using 0 configs

[Fatal Error] :4:28: The markup in the document preceding the root element must be well-formed. org.xml.sax.SAXParseException; lineNumber: 4; columnNumber: 28; The markup in the document preceding the root element must be well-formed. at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339) at com.mxgraph.svg2xml.Svg2Xml.parseXml(Svg2Xml.java:1941) at com.mxgraph.svg2xml.Svg2Xml.(Svg2Xml.java:280) at com.mxgraph.svg2xml.Svg2XmlGui.actionPerformed(Svg2XmlGui.java:249) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6539) at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) at java.awt.Component.processEvent(Component.java:6304) at java.awt.Container.processEvent(Container.java:2239) at java.awt.Component.dispatchEventImpl(Component.java:4889) at java.awt.Container.dispatchEventImpl(Container.java:2297) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476) at java.awt.Container.dispatchEventImpl(Container.java:2283) at java.awt.Window.dispatchEventImpl(Window.java:2746) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84) at java.awt.EventQueue$4.run(EventQueue.java:733) at java.awt.EventQueue$4.run(EventQueue.java:731) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) at java.awt.EventQueue.dispatchEvent(EventQueue.java:730) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at com.mxgraph.svg2xml.Svg2Xml.flattenSvg(Svg2Xml.java:1168) at com.mxgraph.svg2xml.Svg2Xml.(Svg2Xml.java:281) at com.mxgraph.svg2xml.Svg2XmlGui.actionPerformed(Svg2XmlGui.java:249) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6539) at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) at java.awt.Component.processEvent(Component.java:6304) at java.awt.Container.processEvent(Container.java:2239) at java.awt.Component.dispatchEventImpl(Component.java:4889) at java.awt.Container.dispatchEventImpl(Container.java:2297) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476) at java.awt.Container.dispatchEventImpl(Container.java:2283) at java.awt.Window.dispatchEventImpl(Window.java:2746) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84) at java.awt.EventQueue$4.run(EventQueue.java:733) at java.awt.EventQueue$4.run(EventQueue.java:731) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) at java.awt.EventQueue.dispatchEvent(EventQueue.java:730) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)`

I've tried to run with sudo and different combinations of checkboxes(marked as TODO) - nothing changed. Every time I see console output and no xml.

I attach some svg's, it may help to reproduce the problem. svg.zip

Ubuntu 16.04 x64. java version "1.8.0_181" Java(TM) SE Runtime Environment (build 1.8.0_181-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

Is there any other info I can provide to help you resolve this?

alderg commented 6 years ago

And what is the markup in the document preceding the root element? If there is an XML declaration, did you try removing that?

alexstulov commented 6 years ago

I've removed markup preceding svg tag and there is no more error. No xml file either. Just line 'parsing key_1 using 0 configs'.

alexstulov commented 6 years ago

I have another file `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1300px" height="830px" viewBox="0 0 1300 830">

<circle id="e3_circle" cx="715" cy="388" style="fill:darkcyan;stroke:black;stroke-width:1px;" r="84.6494"/>
<g id="e7_group" style="fill:red;stroke:red;" transform="matrix(1 0 0 1 -101 84)">
    <path d="M862,354a86.583806,86.583806,0,0,1,97,1" style="fill:red;stroke:black;stroke-width:1px;"
          id="e4_circleArc" transform="matrix(1 0 0 1 -94 -121)"/>
    <polyline style="stroke:black;fill:red;stroke-width:1px;" id="e5_polyline" points="863 354 909 427 958 354"
              transform="matrix(1 0 0 1 -94 -121)"/>
</g>

, which contains polyline element and gives next response: parsing logo using 0 configs java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1967) at com.mxgraph.svg2xml.Shape2Xml.matrixTransformPoly(Shape2Xml.java:771) at com.mxgraph.svg2xml.Shape2Xml.parse(Shape2Xml.java:131) at com.mxgraph.svg2xml.Svg2Xml.(Svg2Xml.java:474) at com.mxgraph.svg2xml.Svg2XmlGui.actionPerformed(Svg2XmlGui.java:249) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6539) at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) at java.awt.Component.processEvent(Component.java:6304) at java.awt.Container.processEvent(Container.java:2239) at java.awt.Component.dispatchEventImpl(Component.java:4889) at java.awt.Container.dispatchEventImpl(Container.java:2297) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476) at java.awt.Container.dispatchEventImpl(Container.java:2283) at java.awt.Window.dispatchEventImpl(Window.java:2746) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84) at java.awt.EventQueue$4.run(EventQueue.java:733) at java.awt.EventQueue$4.run(EventQueue.java:731) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) at java.awt.EventQueue.dispatchEvent(EventQueue.java:730) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)`

After I remove polyline, same story - no errors, no xml.

egrimate commented 6 years ago

If there is no error, there should be an XML, maybe you're looking at a wrong place. It should be probably in some sub-folders based on source location. Check for all *.xml files in subfolders of your destination folder.

alexstulov commented 6 years ago

Looks like I found the problem. There is an XML, but not where it supposed to be. When I pick folder /home/astulov/Downloads/svg as a destination program creates file at /home/astulov/downloads/svg/picsome/astulov/downloads/svg.xml. When I switch it to /home/astulov/ I get another path: /home/astulov/downloads/svgome/astulov/downloads/svg.xml When I set /home/astulov/Documents/ - /home/astulov/documentsome/astulov/downloads/svg.xml.

egrimate commented 6 years ago

It is working as intended. Check the readme, it describes the logic behind destination selection. Svg2xml is meant to be a mass conversion tool, so the entire source folder structure will be recreated at the destination. If you convert only one file, or one folder, this might be confusing.

alexstulov commented 6 years ago

Yes, it seems a little bit confusing to me. It is intended to create totally different path by lowercasing my Downloads folder. And generate random path every time I change destination folder. And create .xml files anywhere, except the folder I pick with your interface. Is that what supposed to be done when I click start?

Strange path behavior stay when I pick whole folder for processing.

egrimate commented 6 years ago

The path isn't random, just not intuitive at start. Let's say, create a folder called "stencils" on d:\ Now add some subfolders to the "stencils" folder. Add 4-5 SVG files to each subfolder and as source mark the "stencils" folder. By examining the generated files it might be clearer why things aren't random.