Click here to Skip to main content
11,641,668 members (61,543 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: XML
Is there anyone who has an idea of how I can convert flowchart to xml? I need an xml representation of the flowchart. The example of a very simple flowchart will help me get started.

I just need the flowchart to be represented in xml such that i can get the same understanding of the problem from reading xml file instead of looking at the flow chart. That is the xml should be the direct translation of the flowchart.
Posted 18-Sep-12 0:11am
Qobacha538
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Well, you should encode in the XML nodes all the info provided by the flowchart items themselves, namely the shape, the inner text, the (possibly labeled) connections.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

A flowchart is hierarchically structured and XML likewise is hierarchically structured. So what are the difficulties here? I don't know, but you can feel free to add some via a comment. Take an if statement for instance, it consists of a condition, a consequence and an alternative.
So to build this into XML this here seems a valid approach:

<flowchart>
    <if condition="i<1">
	    <consequence>
		    <!-- further XML for the code in the if part -->
		<consequence>
		<alternative>
		    <!-- further XML for the code in the else part -->
		</alternative>
	</if>
</flowchart>

If on the other hand the code inside the condition of the if-statement would become complexer you might make a sepearate tag out of the attribute "condition" like so:

<flowchart>
    <if>
        <condition>
            <!-- further XML for the code of the condition of the if -->
        </condition>
        <consequence>
	    <!-- further XML for the code in the if part -->
	<consequence>
	<alternative>
	    <!-- further XML for the code in the else part -->
	</alternative>
    </if>
</flowchart>

[Modification: Inspired by CPallini's[^] Solution 1[^]]
<flowchart>
    <sequence id="initialization">
        <block id="block1" followRef="block2">
            <!-- further XML for the code for the content of block 1 -->
	    </block>
	    <block id="block2" followRef="block1">
	        <!-- further XML for the code for the content of block 2 -->
	    </block>
    </sequence>
</flowchart>
[End Modification]
The followRef attributes link from one block to another and in this case I even formed a cycle. (Just for instructional purposes though and not so meaningful in this context)
Regards,

— Manfred
  Permalink  
v3
Comments
CPallini at 18-Sep-12 6:55am
   
The flowchart structure however might be cyclic while XML is not. For this very reason I suggested the OP to include the 'shape connections' as info in the XML nodes.
Manfred R. Bihy at 18-Sep-12 7:05am
   
I've deleted my previous comment as I've understood what you meant by cyclic!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 DamithSL 253
1 Mika Wendelius 160
2 Sergey Alexandrovich Kryukov 134
3 OriginalGriff 110
4 Afzaal Ahmad Zeeshan 79
0 Mika Wendelius 460
1 OriginalGriff 265
2 DamithSL 258
3 CPallini 169
4 Afzaal Ahmad Zeeshan 149


Advertise | Privacy | Mobile
Web04 | 2.8.150731.1 | Last Updated 18 Sep 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100