Plantuml generates faulty svg from a script

+1 vote
asked Jan 31, 2020 in Bug by vonhabsi (140 points)
edited Feb 4, 2020 by vonhabsi

The script below generates this faulty uml which I have pasted here at https://pastebin.com/nqjvkbqQ
 

   @startuml
   left to right direction
   actor Kimi << Robot >>
   actor Ivy << Human >>
   (Use the computer) as (Computer) << Main >>
   (Use the iPad) as (iPad) << Secondary >>
   Kimi --> (Computer):emacs
   Ivy --> (Computer):taobao, movie
   Kimi --> (iPad):news, learning languages
   Ivy --> (iPad):taobao, movie
   @enduml

Firefox give the error message:

XML Parsing Error: junk after document element
Location: file:///home/rchurch/DevProjects/CorpDocs/taskdocs/agenda_based/computing_org/cp_15ff3034/firstplant.svg
Line Number 29, Column 14:

Chrome give the error message:

This page contains the following errors:

error on line 30 at column 19: XML declaration allowed only at the start of the document

Below is a rendering of the page up to the first error.

commented Jan 31, 2020 by albert (3,520 points)
Which version of plantuml do you use?

With the version 1.2020.01beta6 I have no problem displaying the generated svg with FireFox (72.0.2)
commented Feb 3, 2020 by vonhabsi (140 points)
This is the version string from the svg file

PlantUML version 1.2020.00(Sat Jan 11 12:30:53 GMT 2020)

I downloaded it from sourceforge no earlier than 29th January

There is a link to the generated file in the pastebin.

My version of Firefox is 73.0beta11, but it fails to download in Chrome as well.

Can you share the file you generated with your version for me to see if it will load in mine?
commented Feb 3, 2020 by albert (3,520 points)

The generated svg file:

<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="263px" preserveAspectRatio="none" style="width:433px;height:263px;" version="1.1" viewBox="0 0 433 263" width="433px" zoomAndPan="magnify"><defs><filter height="300%" id="f15klqe2vlhtop" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><!--MD5=[95603dcd3ae41a83be87f93e7ca7f3f9]
entity Kimi--><ellipse cx="36.5" cy="35.1094" fill="#FEFECE" filter="url(#f15klqe2vlhtop)" rx="8" ry="8" style="stroke: #A80036; stroke-width: 1.5;"/><path d="M36.5,43.1094 L36.5,70.1094 M23.5,51.1094 L49.5,51.1094 M36.5,70.1094 L23.5,85.1094 M36.5,70.1094 L49.5,85.1094 " fill="none" filter="url(#f15klqe2vlhtop)" style="stroke: #A80036; stroke-width: 1.5;"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="26" x="23.5" y="105.1426">Kimi</text><text fill="#000000" font-family="sans-serif" font-size="14" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="54" x="9.5" y="22.5332">«Robot»</text><!--MD5=[eb4f8be7feb0b78bdee01ffdb6c0a61a]
entity Ivy--><ellipse cx="36.5" cy="180.1094" fill="#FEFECE" filter="url(#f15klqe2vlhtop)" rx="8" ry="8" style="stroke: #A80036; stroke-width: 1.5;"/><path d="M36.5,188.1094 L36.5,215.1094 M23.5,196.1094 L49.5,196.1094 M36.5,215.1094 L23.5,230.1094 M36.5,215.1094 L49.5,230.1094 " fill="none" filter="url(#f15klqe2vlhtop)" style="stroke: #A80036; stroke-width: 1.5;"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="17" x="28" y="250.1426">Ivy</text><text fill="#000000" font-family="sans-serif" font-size="14" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="61" x="6" y="167.5332">«Human»</text><ellipse cx="348.8955" cy="69.9942" fill="#FEFECE" filter="url(#f15klqe2vlhtop)" rx="73.8955" ry="25.4942" style="stroke: #A80036; stroke-width: 1.5;"/><text fill="#000000" font-family="sans-serif" font-size="14" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="47" x="325.3955" y="62.8811">«Main»</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="111" x="293.3955" y="80.4905">Use the computer</text><ellipse cx="349.2108" cy="201.1157" fill="#FEFECE" filter="url(#f15klqe2vlhtop)" rx="61.7108" ry="27.6157" style="stroke: #A80036; stroke-width: 1.5;"/><text fill="#000000" font-family="sans-serif" font-size="14" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="84" x="307.2108" y="198.025">«Secondary»</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="80" x="309.2108" y="215.6344">Use the iPad</text><!--MD5=[39b1639c616cf85c9b4a2b8f1a7b37b9]
link Kimi to Computer--><path d="M63.7055,59.013 C108.733,60.753 202.455,64.375 269.999,66.985 " fill="none" id="Kimi-&gt;Computer" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="#A80036" points="275.223,67.187,266.384,62.8429,270.2267,66.9942,266.0754,70.8369,275.223,67.187" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="39" x="151.5" y="57.4951">emacs</text><!--MD5=[25506f8a4a67a405bc3f63cbdf60293d]
link Ivy to Computer--><path d="M67.3388,203.1155 C109.209,202.1387 186.788,196.1022 245,167 C277.266,150.869 306.409,121.323 325.393,99.063 " fill="none" id="Ivy-&gt;Computer" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="#A80036" points="328.818,94.996,319.9605,99.3023,325.5967,98.8201,326.079,104.4563,328.818,94.996" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="80" x="131" y="163.4951">taobao, movie</text><!--MD5=[489c98c35fe44ce9f85c3136c985bb33]
link Kimi to iPad--><path d="M63.6325,74.252 C73.8337,80.243 85.7609,86.825 97,92 C160.464,121.222 181.231,116.451 245,145 C265.722,154.2772 287.942,166.1019 306.419,176.4927 " fill="none" id="Kimi-&gt;iPad" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="#A80036" points="311.033,179.1011,305.1679,171.189,306.6807,176.6398,301.2299,178.1527,311.033,179.1011" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="146" x="98" y="88.4951">news, learning languages</text><!--MD5=[642d851a519ce061ad906d7cdb05de69]
link Ivy to iPad--><path d="M67.19,216.3207 C76.5366,219.8718 87.0261,223.2151 97,225 C161.749,236.5871 179.653,232.5127 245,225 C260.241,223.2478 276.506,220.0827 291.502,216.6137 " fill="none" id="Ivy-&gt;iPad" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="#A80036" points="296.536,215.4272,286.8584,213.5988,291.6694,216.5744,288.6938,221.3854,296.536,215.4272" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="80" x="131" y="221.4951">taobao, movie</text><!--MD5=[de65060f9176dd0b72a093eb44716486]
@startuml
 left to right direction
 actor Kimi << Robot >>
 actor Ivy << Human >>
 (Use the computer) as (Computer) << Main >>
 (Use the iPad) as (iPad) << Secondary >>
 Kimi - -> (Computer):emacs
 Ivy - -> (Computer):taobao, movie
 Kimi - -> (iPad):news, learning languages
 Ivy - -> (iPad):taobao, movie
 @enduml

PlantUML version 1.2020.01beta6(Unknown compile time)
(GPL source distribution)
Java Runtime: Java(TM) SE Runtime Environment
JVM: Java HotSpot(TM) Client VM
Java Version: 1.7.0_67-b01
Operating System: Windows 8.1
Default Encoding: Cp1252
Language: en
Country: US
--></g></svg>

commented Feb 4, 2020 by vonhabsi (140 points)
After analyzing the generated code it I see the version I downloaded adds an additional graphic and message which is causing the error.

PlantUML version 1.2020.00(Sat Jan 11 12:30:53 GMT 2020)

Your version appears to be a different one. Where do you download it?

<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="257px" preserveAspectRatio="none" style="width:590px;height:257px;" version="1.1" viewBox="0 0 590 257" width="590px" zoomAndPan="magnify"><defs/><g><text fill="#000000" font-family="sans-serif" font-size="12" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="159" x="5" y="16.1387">Welcome to PlantUML!</text><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="0" x="9" y="30.1074"/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="293" x="5" y="44.0762">If you use this software, you accept its license.</text><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="107" x="5" y="58.0449">(details by typing</text><text fill="#000000" font-family="monospace" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="49" x="116" y="58.0449">license</text><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="56" x="169" y="58.0449">keyword)</text><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="0" x="9" y="72.0137"/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="283" x="5" y="85.9824">You can start with a simple UML Diagram like:</text><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="0" x="9" y="99.9512"/><text fill="#000000" font-family="monospace" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="119" x="5" y="113.9199">Bob-&gt;Alice: Hello</text><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="0" x="9" y="127.8887"/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="14" x="5" y="141.8574">Or</text><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="0" x="9" y="155.8262"/><text fill="#000000" font-family="monospace" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="91" x="5" y="169.7949">class Example</text><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="0" x="9" y="183.7637"/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="349" x="5" y="197.7324">You will find more information about PlantUML syntax on</text><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" text-decoration="underline" textLength="122" x="358" y="197.7324">http://plantuml.com</text><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="0" x="9" y="211.7012"/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="0" x="9" y="225.6699"/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="0" x="9" y="239.6387"/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="0" x="9" y="253.6074"/><image height="71" width="80" x="510" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABHCAMAAACnHDC8AAADAFBMVEX///+BpbvD3u/f7vfPz8+nz+g3ksuZEDkWADr/ujlvsdpTodLCwsOLwOEbg8T//v6pqamZETnLysvT09To5+jqLS4VATj9/f27u7vDw8MTfsK+v7/j4+SOweJprdjL4/KxsbEri8jk8PgXa57c29uUETez1utQoNJ1tNtEmc9cptWBut6ayOW/3O6YEDjY6vUfhcXBwcHs7Ozw9/v83t79uTn7+/vX19ehoaHx8fG2tLXHx8fuVlfrNTYaBjn/vUH5+fmko6WXl5f/+fn95ub+9PT+8PD3qKidmaMxIUrnqDWcFj7n5eX09PTu7u2SkpKfnZ6rq6z0lJTm4tzJrHUfDT339/eFGDn6tjcrEzOvrbBuZ3l4eomSMS7Hz9Smpqasu8SFiYuQETfa2du1m6OOM051J0NWTWL5xse4uLj6zc33r6/4vb7ydHXqLi/72dntTE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aB3RtoHXDbEmxwv3LDOWiT/5gT2ODiqx+hcWH0SOcAwkBweXjxaEzkArCXBVl+cvzac74DmlkMpd7/ZgEF0vue5xARBQnOC06g4uTvQWhkCCjaifI8QPYypPLZz+cFc6HgC1hkCGg8NH59EiUhffx18wNKIzDgABMj4xu4C2EJ4o1u7TVi6vEXDAwc/BhdATlsFf0ie+eZ6Cp5biielUcR0T7/XxS1lXqYQcP8HFILFFnuwr+9i1C8TDJArpchNTLTfgoNRGvbLPrWeIbazSeZBX+kydbMgnX8UFjvMLkG+q4HABVtKp9tQ9JtAAAAAElFTkSuQmCC" y="185.4375"/><!--MD5=[e8d6cdde175f3c6e1792ccaa378f2d59]
PlantUML version 1.2020.00(Sat Jan 11 12:30:53 GMT 2020)
(GPL source distribution)
Java Runtime: OpenJDK Runtime Environment
JVM: OpenJDK 64-Bit Server VM
Java Version: 1.8.0_232-8u232-b09-1~deb9u1-b09
Operating System: Linux
Default Encoding: UTF-8
Language: en
Country: GB
--></g></svg>
commented Feb 4, 2020 by vonhabsi (140 points)
I have created a new question for it at https://forum.plantuml.net/10795/there-command-option-suppress-the-generation-secondary-file as it seems to be something in the plantuml build or a missing command option.

Thanks
commented Feb 4, 2020 by albert (3,520 points)
I download my (beta) versions always from http://beta.plantuml.net/plantuml.jar

1 Answer

+1 vote
answered Feb 25, 2020 by Hui Liu
edited Feb 25, 2020
org-mode in emacs?

It seems you should NOT include the @startuml/@enduml tags in the code block if you want export SVG file.

Switch to *Message* buffer and find the java command to generate the SVG file, then find the temp puml file path, check the content, you will see multiple @startuml/@enduml pairs.

Check this link below:

https://lists.gnu.org/archive/html/emacs-orgmode/2018-03/msg00405.html
...