流程图的Xml表示形式 [英] Xml Representation of the flowchart

查看:798
本文介绍了流程图的Xml表示形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何将流程图转换为xml吗?我需要流程图的xml表示形式.一个非常简单的流程图示例将帮助我入门.

我只需要将流程图表示为xml,这样我就可以通过阅读xml文件而不是查看流程图来对问题有相同的理解.那就是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.

推荐答案

好吧,您应该在XML节点中对流程图项本身提供的所有信息进行编码. ,即形状,内部文本,(可能标记为)连接.
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.


流程图是分层结构的,而XML同样也是分层结构的.那么这里有什么困难呢?我不知道,但是您可以随时通过评论添加一些内容.以if语句为例,它由条件,结果和替代组成.
因此,将其构建为XML似乎是一种有效的方法:

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语句条件内的代码变得更复杂,则可以从属性"condition"中创建一个独立的标签,如下所示:


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>



[修改: CPallini的启发 [ ^ ]



[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>


[最终修改]
followRef属性从一个块链接到另一个块,在这种情况下,我什至形成了一个循环. (尽管只是出于教学目的,但在这种情况下意义不大)
问候,

—曼弗雷德(Manfred)


[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


这篇关于流程图的Xml表示形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆