Inhalt
Topic:.readme_BillOfMaterial.
pStyle=std tableStyle=stdTable
.
Topic:.readme_BillOfMaterial..
pStyle=std tableStyle=stdTable
This is a simple example showing the usage of the ZBNF-Parser.
The Bill of Material is given in a simple text format with well syntax. It may be an output from another computing system. The example in the
file billOfMaterial.txt is very short, only the principles should be shown.
Topic:.readme_BillOfMaterial..
pStyle=std tableStyle=stdTable
The Batchfile billOfMaterial.bat or the Unix-shellscript billOfMaterial.sh calls the Zbnf2Xml-Conversion and produces a XML file named billOfMaterial.xml. To compare the correctness of translation, the file billOfMaterial.reference.xml is given in this download, It should be identically with the generated file.
In praxis, the bill of material, given in XML-Format may be post-processed by several XML Tools, the world of XML is open after the Zbnf2Xml translation.
Topic:.readme_BillOfMaterial..
pStyle=std tableStyle=stdTable
The Example contains some Java source files in srcJava/org/vishia/zbnf/example/billOfMaterial. This source files should be compiled at example in a eclipse environment. The sourcepath for compilation is set to this
local source folder and to the ../../srcJava.Zbnf, or the ../../zbnfjax/zbnf.jar is to be added as library. The Java-example executes the parsing like above, than the result will be written in an instance.
It is an example only. The example uses the principles of class-src:_org/vishia/mainCmd/MainCmd, therefore the frame is more complexly as necessary for this example. The decisive methods are:
void executeStoreFields(Args args)
{
/**The instance to store the data of parsing result is created locally and private visible: */
BillOfMaterialZbnf_Fields bill = new BillOfMaterialZbnf_Fields();
/**This call processes the whole parsing and storing action in the instance 'bill', using the type of bill.
* It is the simple form.
* In this basic example the data won't be used never, therefore please set a breakpoint here
* and check the data manually.
*/
String sError = ZbnfJavaOutput.parseFileAndFillJavaObject(bill.getClass(), bill, ...)
and
void executeStoreViaMethods(Args args)
{
/**The instance to store the data of parsing result is created locally and private visible,
* but it is referenced with an interface. It is possible that the instance is created somewhere other. */
BillOfMaterial_Zbnf_ifc.ZbnfStore_BillOfMaterial bill = new BillofMaterialData_Methods();
/**This call processes the whole parsing and storing action in the instance 'bill', using the type of bill.
* It is the qualification form. The instance is referenced via an interface.
* The construction of the instance' data is not depending on the syntax form.
* Some more checks and data processing may be done in the implementation of the interface' methods.
* In this basic example the data won't be used never, therefore please set a breakpoint here
* and check the data manually.
*/
String sError = ZbnfJavaOutput.parseFileAndFillJavaObject(BillOfMaterial_Zbnf_ifc.ZbnfStore_BillOfMaterial.class, bill, ...
The called routine parses and stores the result in a slide. The first version uses an instance, which follows the construction of syntax in the construction of its data. It is simple. The second version shows the usage of interfaces to store the data for a more complex evaluation.
To examine the Java evaluation you should familiar with compiling Java in an IDE like eclipse. Set a breakpoint before the
call of parseFileAndFillJavaObject(...) visit the stored data, change the syntax and/or storage classes. The evaluation of the data may be a typical java programming
procedure.
Topic:.readme_BillOfMaterial..
pStyle=std tableStyle=stdTable
.
<DIR> srcJava billOfMaterial.txt billOfMaterial.bat billOfMaterial.sh billOfMaterial.zbnf billOfMaterial.reference.xml del_results.bat del_results.sh readme.html
srcJava: Directory with java-source org/vishia/zbnf/example/billOfMaterial/*.java
billOfMaterial.txt: Given bill list as example.
billOfMaterial.bat, billOfMaterial.sh: batches (Windows, Unix) which invoke the conversion Zbnf2Xml
billOfMaterial.zbnf: Syntax of the input-file.
billOfMaterial.reference.xml: The reference for the created XML-file after invoking billOfMaterial.bat or billOfMaterial.sh.
del_results.bat, del_results.sh: batches (Windows, Unix) to clean results (helper).