From 05c77a49693c49ea190ae7d44ae106d85a42303e Mon Sep 17 00:00:00 2001 From: Eric Paul Date: Mon, 22 Jun 2020 11:18:58 +0530 Subject: Update README.md --- README.md | 53 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 1242615..07378f2 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,45 @@ -The aim of this project is to provide a software which converts a Scilab 5.5.2 file to Scilab 6.0.2 file. The code is written in python and the package used is Element tree. Python Element tree is a lxml package and it is a XML.The xml.etree.ElementTree module implements a simple and efficient API for parsing and creating XML data. +# Xcos-Converter -XPath (XML Path Language) is a query language for selecting nodes from an XML document. XPath uses "path like" syntax to identify and navigate nodes in an XML document.The XPath language is based on a tree representation of the XML document, and provides the ability to navigate around the tree, selecting nodes by a variety of criteria. +The aim of this project is to provide a software which converts a Scilab 5.5.2 file to Scilab 6.0.2 file. The code is written in python and the package used is Element tree. -Xcos is a Scilab toolbox for modeling and simulation of dynamic (continuous and discrete) systems. Although the main purpose is to simulate dynamic systems. +## Getting Started -The relationship between Xcos and Xml is that Xcos is written in the same format as XML with Xcos specific tags. So, we can parse Xcos files as XML files. +There are two main files used in the project, parser.py & conf.py. Inorder to run the project run the parser.py. The other files present are the input xcos files for the project -The files used in this project are: +### Requirement -1. Parser.py: -The parser file uses conf.py to get the xpath and the rule.The first part of the code deals with xpath. Xpaths are needed to find the exact nodes we have to work with , it guarantees that no other nodes which might have similar tag names are affected. -Inorder to build the xpath , it refers to the variable path in the conf file. Once the xpath is built it goes through the rule variable in the conf file to find out which operation has to be applied to the node found using xpath. +The technologies required for this project are : + - Ubuntu 16 & up + - Python 3.6 -2. Conf.py +Python element tree doesnt need to be installed as it is already present in the python package, it only needs to be imported. -In this file we have globally defined all variables. All the operations that are to be performed are mentioned at the beginning of this file.  - This file contains two lists i.e. path and rule. - -Path : - Path has nodes like tag, attribute, subtag, sub attributes that are to be changed. It deals with Xpath in the parser.py file. This nodes are declared using pattern ‘KEY_PATH_*’. - Initially, path list is declared empty. Later on nodes get appended to this list according to the requirement of Xpath written in the parser.py file. +## Running the Project -Rule : - Rule has a list of nodes with changed values. This nodes are declared using pattern ‘KEY_RULE_*’. - At first, this list is empty. When Xpath in the parser.py file gets the desired node, the operation related to it is performed. And the list gets appended with changed nodes. The operations are declared using the pattern ‘KEY_RULE_OP’. +As mentioned before the two main files for this project are parser.py and conf.py . +Before you run the program make sure the desired input file is given to the code. + +``` +tree = ET.parse('CMSCOPE.xcos') +``` +In place of 'CMSCOPE.xcos' you can give your desired file. +The name of the output file produced by the code can also be changed. + +``` +tree.write('new.xcos', encoding="UTF-8", xml_declaration=True) +``` +In place of 'new.xcos' enter your desired name. + +Now run parser.py in the terminal as follows : + +``` +python parser.py +``` +Note : Make sure the inputs given to parser are in the same folder. You can check the output by opening the file 'new.xcos' or the name given by you. + + +## Note + +All the latest code have been pused to the Python branch , please refer that. -- cgit