Open richardmarston opened 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.
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?
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.
Thanks achim. If you still have time you can do sections 6 to 8 too.
I tried to create Section 6 to 8 and ran into some problems. Section 6:
For UseCaseRepository.mustache i found no examples with Requirements except the elering-1 example. This example however is somehow broken. The dict structure is not as assumed. I think it is related to the fact, that the UseCaseLibrary contains only a single UseCase. I tried to somehow fix this example by adding another empty UseCase but was still not able to create Sections 1-5 for elering-1.
For UseCase.mustache the only known example with Requirements is the offis-2 example. In this example, the requirements are only listed as an attribute of an InformationObject. It only contains the properties "id" and "requirementCategoryId". The "id" is already printed in Section 5. So I'm not really sure what to display here.
There is no table specification in the templates. In the "elering-1" example there is a lot of information such as id,name,description,mRID while in the "offis-2" example there is only an id and an requirementCategoryId. I'm not sure which information to display.
Section 7:
Section 8:
Can i find some more examples somewhere? Or is there a complete description of the standard somewhere?
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
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
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.
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
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
Hi Richard you are right my bad. I fixed the intendation and added an addLibraryObjects fct.
Thanks! I have merged this work into master now.
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.