richardmarston / xml2md

Tool to convert use cases in XML format to markdown
Apache License 2.0
0 stars 0 forks source link

Add Section 3 #1

Open richardmarston opened 4 years ago

richardmarston commented 4 years ago

There are two template files in this project because there are two xml formats. They are called UseCase.mustache and UseCaseRepository.mustache. They need to be updated so that the fields relevant to Section 3 are populated in the output.

Preferably this will be achieved without editing xml2md.py.

achim-voelker commented 4 years ago

I completed the issue on branch "voelker".
I think most of the file is converted correctly. But the actor description often has controll characters included such as <"br/> which can not be recognized in MD. Should i just remove them or try to replace them with the euqivalent MD controll characters?

Additionally i found no example xml with a link property for references. I just assumed it will be called <'link'>.

I needed to modify the xml2md.py due to the fact that the ActorLibrary was missing in the dict passed to the template.

richardmarston commented 4 years ago

The MD is not the final form that we are going to use. It will be input for Markus' webserver. I think that we should ignore the control characters for now because they may be useful for the website.

I have no idea if the link attribute is called link, it's not a bad guess.

Passing the missing ActorLibrary in is the right thing to do.

Do you want to do sections 4 and 5 in the same branch?

achim-voelker commented 4 years ago

I modified the templates to recognize sections 4,5 and pushed the changes to the branch "voelker". In case there was no example for an attribute in the provided example xml's i left the respective field filled with "---". Similar to section 3 there are fields with a lot of control sequences. They sometimes break the formatting of the MD file but since MD is not the final form i ignored them.

richardmarston commented 4 years ago

Thanks achim. If you still have time you can do sections 6 to 8 too.

achim-voelker commented 4 years ago

I tried to create Section 6 to 8 and ran into some problems. Section 6:

Section 7:

Section 8:

Can i find some more examples somewhere? Or is there a complete description of the standard somewhere?

richardmarston commented 4 years ago

Hi achim,

I have fixed the problem with elering-1 example but it's not checked in yet.

Just check in what you have working for now, I will go check over each section.

Thanks for your help with this!

Richard

achim-voelker commented 4 years ago

I pushed my current state. But for section 6,7,8 there are only ideas and nothing tested since i had no working examples. Is there anything else to do for me right now? If u push the fix for the elering-1 example i can check section 6 myself. If you can provide me more examples i can also create section 7,8

richardmarston commented 4 years ago

I have commited the fix for elering-1 so you can look at section 6.

I don't have any more examples, but you can ask Markus if he does.

achim-voelker commented 4 years ago

I tested section 6 for UseCaseRepository.mustache and the results loook good. For UseCase.mustache i'm still not sure what to display and how. In the examples the requirements exists only in the InformationObject which is already displayed in section 5. I found a link in the offis-2 example in which the requirement list template should be defined but i'm not able to access it even when accesing from the RWTH network. https://webstore.iec.ch/publication/22349

Section 7,8 are not frequently used according to Markus

richardmarston commented 4 years ago

Thank you for doing this work.

The changes in xml2md.py need to be modified slightly. You have changed the indentation of the block under

with open(filename) as xmlfile:
        usecase = None
        xmlobj = xmltodict.parse(xmlfile.read())

if 'UC:UseCaseRepository' in xmlobj:
....
xmlfile.close()

The problem that is introduced by this change is that the xmlobj could still look like valid from a previous iteration of the loop. Or, if the file has failed to read on the first attempt then xmlobj might not have been initialised and we will get an error on reading it. Finally the close() function will not be called the correct number of times. Python has garbage collection but it is good practice to close a file each time you open it.

Please put the indentation back how it was, and write a function for all of the assignments:

usecase[x] = xmlobj['UC:UseCaseRepository'][x]

so that we don't have two identical blocks of code. Finally, remove any extra print lines that you added.

Thanks!

Richard Marston

achim-voelker commented 4 years ago

Hi Richard you are right my bad. I fixed the intendation and added an addLibraryObjects fct.

richardmarston commented 4 years ago

Thanks! I have merged this work into master now.