Alanick wrote: ↑10 Nov 2022 20:28
I am lost for words, now the entire
library_geometries tag is corrupt, the opening/closing tags of its child elements are all messed up, this time around i have no clue how to even describe what exactly is wrong, i am baffled
Mmmm... You don't need to search for superlative adjetives to describe the problem; just post a segment of the output file that present the problem... Why you didn't do that?
I completed several tests with the provided data files and compared the output of my previous code version vs. the last one. I first completed a test with files 001.xml, 002.xml and 003.xml. The output of both code versions is
exactly the same...
Then I did a test with files 0813.xml, 0819.xml and 0911.xml. With these files the old code fail when processing the <library_geometries> tag of files #2 and #3, so the trace not reports how many child items were processed from these files. The new code correctly process all child items of all files and the trace reports 20 items added from file #2 and 32 from file #3, so the generated output.txt file is significantly larger than the old version's one.
I taken the generated 7,570 KB output.txt file and removed all excepting the first and the two last items of library_geometries tag, and shortened all float_array and p long fields. This is the result:
Code: Select all
<library_geometries>
<geometry id="0x2BE72C7D" name="XT_BUSH_FOREST_SMACK1A_JG_00">
<mesh>
<source id="0x2BE72C7D_positions" name="position">
<float_array id="0x2BE72C7D_positions_array" count="132">0.035645 -1.103516 ... -0.389191 0.442637</float_array>
<technique_common>
<accessor count="44" source="#0x2BE72C7D_positions_array" stride="3">
<param name="X" type="float" />
<param name="Y" type="float" />
<param name="Z" type="float" />
</accessor>
</technique_common>
</source>
<source id="0x2BE72C7D_texcoords" name="texcoords">
<float_array id="0x2BE72C7D_texcoords_array" count="88">0.589844 -0.000000 ... -1.000000 0.589844 -1.000000</float_array>
<technique_common>
<accessor count="44" source="#0x2BE72C7D_texcoords_array" stride="2">
<param name="S" type="float" />
<param name="T" type="float" />
</accessor>
</technique_common>
</source>
<source id="0x2BE72C7D_mat0_normals" name="normal">
<float_array id="0x2BE72C7D_mat0_normals_array" count="132">-0.579751 -0.710834 ... -0.405257 0.527302</float_array>
<technique_common>
<accessor count="44" source="#0x2BE72C7D_mat0_normals_array" stride="3">
<param name="X" type="float" />
<param name="Y" type="float" />
<param name="Z" type="float" />
</accessor>
</technique_common>
</source>
<source id="0x2BE72C7D_mat0_colors" name="color">
<float_array id="0x2BE72C7D_mat0_colors_array" count="132">0.325490 0.325490 ... 0.325490 0.325490 0.325490</float_array>
<technique_common>
<accessor count="44" source="#0x2BE72C7D_mat0_colors_array" stride="3">
<param name="R" type="float" />
<param name="G" type="float" />
<param name="B" type="float" />
</accessor>
</technique_common>
</source>
<vertices id="0x2BE72C7D_vertices">
<input semantic="POSITION" source="#0x2BE72C7D_positions" />
</vertices>
<triangles count="22" material="material0">
<input offset="0" semantic="VERTEX" source="#0x2BE72C7D_vertices" />
<input offset="1" semantic="TEXCOORD" source="#0x2BE72C7D_texcoords" />
<input offset="2" semantic="NORMAL" source="#0x2BE72C7D_mat0_normals" />
<input offset="3" semantic="COLOR" source="#0x2BE72C7D_mat0_colors" />
<p>0 0 0 0 1 1 1 1 2 2 2 2 2 2 2 2 ... 40 40 40 40</p>
</triangles>
</mesh>
</geometry>
. . . . .
<geometry id="0xD46A6A25" name="XO_BOLLARDA_1B_CK_00_DEINST1_I11">
<mesh>
<source id="0xD46A6A25_positions" name="position">
<float_array id="0xD46A6A25_positions_array" count="2202">932.502808 3513.485840 ... 3514.437744 200.145569</float_array>
<technique_common>
<accessor count="734" source="#0xD46A6A25_positions_array" stride="3">
<param name="X" type="float" />
<param name="Y" type="float" />
<param name="Z" type="float" />
</accessor>
</technique_common>
</source>
<source id="0xD46A6A25_texcoords" name="texcoords">
<float_array id="0xD46A6A25_texcoords_array" count="1468">0.291016 ... 0.431641 -0.720703</float_array>
<technique_common>
<accessor count="734" source="#0xD46A6A25_texcoords_array" stride="2">
<param name="S" type="float" />
<param name="T" type="float" />
</accessor>
</technique_common>
</source>
<source id="0xD46A6A25_mat0_normals" name="normal">
<float_array id="0xD46A6A25_mat0_normals_array" count="2202">0.000000 -1.000000 ... 0.000000 1.000000</float_array>
<technique_common>
<accessor count="734" source="#0xD46A6A25_mat0_normals_array" stride="3">
<param name="X" type="float" />
<param name="Y" type="float" />
<param name="Z" type="float" />
</accessor>
</technique_common>
</source>
<source id="0xD46A6A25_mat0_colors" name="color">
<float_array id="0xD46A6A25_mat0_colors_array" count="2202">0.329412 ... 0.223529 0.223529</float_array>
<technique_common>
<accessor count="734" source="#0xD46A6A25_mat0_colors_array" stride="3">
<param name="R" type="float" />
<param name="G" type="float" />
<param name="B" type="float" />
</accessor>
</technique_common>
</source>
<vertices id="0xD46A6A25_vertices">
<input semantic="POSITION" source="#0xD46A6A25_positions" />
</vertices>
<triangles count="272" material="material0">
<input offset="0" semantic="VERTEX" source="#0xD46A6A25_vertices" />
<input offset="1" semantic="TEXCOORD" source="#0xD46A6A25_texcoords" />
<input offset="2" semantic="NORMAL" source="#0xD46A6A25_mat0_normals" />
<input offset="3" semantic="COLOR" source="#0xD46A6A25_mat0_colors" />
<p>0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 ... 730 730 730 730</p>
</triangles>
</mesh>
</geometry>
<geometry id="0x55CA48D7" name="XT_GC_BUSH_1B_00_DEINST1_I11">
<mesh>
<source id="0x55CA48D7_positions" name="position">
<float_array id="0x55CA48D7_positions_array" count="186">937.784851 ... 3588.885498 212.205322</float_array>
<technique_common>
<accessor count="62" source="#0x55CA48D7_positions_array" stride="3">
<param name="X" type="float" />
<param name="Y" type="float" />
<param name="Z" type="float" />
</accessor>
</technique_common>
</source>
<source id="0x55CA48D7_texcoords" name="texcoords">
<float_array id="0x55CA48D7_texcoords_array" count="124">0.505859 ... 1.000000 -1.000000</float_array>
<technique_common>
<accessor count="62" source="#0x55CA48D7_texcoords_array" stride="2">
<param name="S" type="float" />
<param name="T" type="float" />
</accessor>
</technique_common>
</source>
<source id="0x55CA48D7_mat0_normals" name="normal">
<float_array id="0x55CA48D7_mat0_normals_array" count="186">0.250123 ... -0.653945 0.004347</float_array>
<technique_common>
<accessor count="62" source="#0x55CA48D7_mat0_normals_array" stride="3">
<param name="X" type="float" />
<param name="Y" type="float" />
<param name="Z" type="float" />
</accessor>
</technique_common>
</source>
<source id="0x55CA48D7_mat0_colors" name="color">
<float_array id="0x55CA48D7_mat0_colors_array" count="186">0.121569 ... 0.105882 0.105882</float_array>
<technique_common>
<accessor count="62" source="#0x55CA48D7_mat0_colors_array" stride="3">
<param name="R" type="float" />
<param name="G" type="float" />
<param name="B" type="float" />
</accessor>
</technique_common>
</source>
<vertices id="0x55CA48D7_vertices">
<input semantic="POSITION" source="#0x55CA48D7_positions" />
</vertices>
<triangles count="28" material="material0">
<input offset="0" semantic="VERTEX" source="#0x55CA48D7_vertices" />
<input offset="1" semantic="TEXCOORD" source="#0x55CA48D7_texcoords" />
<input offset="2" semantic="NORMAL" source="#0x55CA48D7_mat0_normals" />
<input offset="3" semantic="COLOR" source="#0x55CA48D7_mat0_colors" />
<p>0 0 0 0 1 1 1 1 ... 61 61 61 61</p>
</triangles>
</mesh>
</geometry>
</library_geometries>
Finally I did a similar test with 0103.xml, 0104.xml and 0105.xml files. In this case the generated output.txt files from the two code versions are also different. This is a
FC comparison of both output.txt files:
Code: Select all
Comparando archivos output-OLD.txt y OUTPUT-NEW.TXT
***** output-OLD.txt
9766 -0.000000 0.666016 -1.000000 3.109375 -0.142578 3.109375 -0.000000 -1.10937
5 -0.000000 -1.109375 -0.142578 3.109375 -1.000
000 3.109375 -0.000000 -1.109375 -0.000000 -1.109375 -1.000000</float_array>578
3.109375 -1.000000 3.109375 -0.000000 -1.109375
-0.000000 -1.109375 -1.000000 0.000000 -1.000000 0.000000 -0.000000 0.509766 -0
.000000 0.666016 -1.000000 3.109375 -0.142578 3
.109375 -0.000000 -1.109375 -0.000000 -1.109375 -0.142578 3.109375 -1.000000 3.1
09375 -0.000000 -1.109375 -0.000000 -1.109375 -
1.000000 0.000000 -1.000000 0.000000 -0.000000 0.509766 -0.000000 0.666016 -1.00
0000 3.109375 -0.142578 3.109375 -0.000000 -1.1
09375 -0.000000 -1.109375 -0.142578 3.109375 -1.000000 3.109375 -0.000000 -1.109
375 -0.000000 -1.109375 -1.000000 0.000000 -1.0
00000 0.000000 -0.000000 0.509766 -0.000000 0.666016 -1.000000 3.109375 -0.14257
8 3.109375 -0.000000 -1.109375 -0.000000 -1.109
375 -0.142578 3.109375 -1.000000 3.109375 -0.000000 -1.109375 -0.000000 -1.10937
5 -1.000000 0.000000 -1.000000 0.000000 -0.0000
00 0.509766 -0.000000 0.666016 -1.000000 3.109375 -0.142578 3.109375 -0.000000 -
1.109375 -0.000000 -1.109375 -0.142578 3.109375
-1.000000 3.109375 -0.000000 -1.109375 -0.000000 -1.109375 -1.000000</float_arr
ay> <technique_common>
<accessor count="1554" source="#0xCDB9D0DA_texcoords_array" stride="
2">
***** OUTPUT-NEW.TXT
9766 -0.000000 0.666016 -1.000000 3.109375 -0.142578 3.109375 -0.000000 -1.10937
5 -0.000000 -1.109375 -0.142578 3.109375 -1.000
000 3.109375 -0.000000 -1.109375 -0.000000 -1.109375 -1.000000</float_array>
<technique_common>
<accessor count="1554" source="#0xCDB9D0DA_texcoords_array" stride="
2">
*****
The old version file have the error you reported: after the
</float_array> closing tag a part of the same child field is repeated and the separation of the next
<technique_common> tag is omitted. The new version output file have this error fixed. This is
the only difference in these two files.
I taken this last output.txt file and deleted almost all of it excepting a couple items from <library_geometries> tag, and shortened its very long fields. This is the result:
Code: Select all
<library_geometries>
<geometry id="0x6A76F2DC" name="XO_HYDRANTA_1A_BK_00">
<mesh>
<source id="0x6A76F2DC_positions" name="position">
<float_array id="0x6A76F2DC_positions_array" count="984">0.213135 0.000000 ... 0.202759 0.000000</float_array>
<technique_common>
<accessor count="328" source="#0x6A76F2DC_positions_array" stride="3">
<param name="X" type="float" />
<param name="Y" type="float" />
<param name="Z" type="float" />
</accessor>
</technique_common>
</source>
<source id="0x6A76F2DC_texcoords" name="texcoords">
<float_array id="0x6A76F2DC_texcoords_array" count="656">0.001953 -0.283203 ... 0.818359 -0.994141</float_array>
<technique_common>
<accessor count="328" source="#0x6A76F2DC_texcoords_array" stride="2">
<param name="S" type="float" />
<param name="T" type="float" />
</accessor>
</technique_common>
</source>
<source id="0x6A76F2DC_mat0_normals" name="normal">
<float_array id="0x6A76F2DC_mat0_normals_array" count="984">0.994190 0.107642 ... 0.000000 -1.000000</float_array>
<technique_common>
<accessor count="328" source="#0x6A76F2DC_mat0_normals_array" stride="3">
<param name="X" type="float" />
<param name="Y" type="float" />
<param name="Z" type="float" />
</accessor>
</technique_common>
</source>
<source id="0x6A76F2DC_mat0_colors" name="color">
<float_array id="0x6A76F2DC_mat0_colors_array" count="984">0.309804 0.309804 ... 0.184314 0.184314</float_array>
<technique_common>
<accessor count="328" source="#0x6A76F2DC_mat0_colors_array" stride="3">
<param name="R" type="float" />
<param name="G" type="float" />
<param name="B" type="float" />
</accessor>
</technique_common>
</source>
<vertices id="0x6A76F2DC_vertices">
<input semantic="POSITION" source="#0x6A76F2DC_positions" />
</vertices>
<triangles count="305" material="material0">
<input offset="0" semantic="VERTEX" source="#0x6A76F2DC_vertices" />
<input offset="1" semantic="TEXCOORD" source="#0x6A76F2DC_texcoords" />
<input offset="2" semantic="NORMAL" source="#0x6A76F2DC_mat0_normals" />
<input offset="3" semantic="COLOR" source="#0x6A76F2DC_mat0_colors" />
<p>0 0 0 0 1 1 1 1 2 2 2 2 2 2 2 2 ... 326 326 326 326 313 313 313 313 324 324 324 324 327 327 327 327</p>
</triangles>
</mesh>
</geometry>
<geometry id="0x8327AAA3" name="XT_CT_FALLTREES_1B_JG_00">
<mesh>
<source id="0x8327AAA3_positions" name="position">
<float_array id="0x8327AAA3_positions_array" count="1137">0.320007 0.413834 ... 0.007645 7.958358</float_array>
<technique_common>
<accessor count="379" source="#0x8327AAA3_positions_array" stride="3">
<param name="X" type="float" />
<param name="Y" type="float" />
<param name="Z" type="float" />
</accessor>
</technique_common>
</source>
<source id="0x8327AAA3_texcoords" name="texcoords">
<float_array id="0x8327AAA3_texcoords_array" count="758">2.000000 -0.695313 ... 1.000000 -1.000000</float_array>
<technique_common>
<accessor count="379" source="#0x8327AAA3_texcoords_array" stride="2">
<param name="S" type="float" />
<param name="T" type="float" />
</accessor>
</technique_common>
</source>
<source id="0x8327AAA3_mat0_normals" name="normal">
<float_array id="0x8327AAA3_mat0_normals_array" count="945">0.594168 0.798541 ... 0.954073 -0.030828</float_array>
<technique_common>
<accessor count="315" source="#0x8327AAA3_mat0_normals_array" stride="3">
<param name="X" type="float" />
<param name="Y" type="float" />
<param name="Z" type="float" />
</accessor>
</technique_common>
</source>
<source id="0x8327AAA3_mat0_colors" name="color">
<float_array id="0x8327AAA3_mat0_colors_array" count="945">0.227451 0.227451 ... 0.184314 0.184314</float_array>
<technique_common>
<accessor count="315" source="#0x8327AAA3_mat0_colors_array" stride="3">
<param name="R" type="float" />
<param name="G" type="float" />
<param name="B" type="float" />
</accessor>
</technique_common>
</source>
<source id="0x8327AAA3_mat1_normals" name="normal">
<float_array id="0x8327AAA3_mat1_normals_array" count="192">-0.219406 -0.113456 ... -0.704975 0.053980 -0.707175</float_array>
<technique_common>
<accessor count="64" source="#0x8327AAA3_mat1_normals_array" stride="3">
<param name="X" type="float" />
<param name="Y" type="float" />
<param name="Z" type="float" />
</accessor>
</technique_common>
</source>
<source id="0x8327AAA3_mat1_colors" name="color">
<float_array id="0x8327AAA3_mat1_colors_array" count="192">0.270588 0.270588 ... 0.184314 0.184314</float_array>
<technique_common>
<accessor count="64" source="#0x8327AAA3_mat1_colors_array" stride="3">
<param name="R" type="float" />
<param name="G" type="float" />
<param name="B" type="float" />
</accessor>
</technique_common>
</source>
<vertices id="0x8327AAA3_vertices">
<input semantic="POSITION" source="#0x8327AAA3_positions" />
</vertices>
<triangles count="110" material="material0">
<input offset="0" semantic="VERTEX" source="#0x8327AAA3_vertices" />
<input offset="1" semantic="TEXCOORD" source="#0x8327AAA3_texcoords" />
<input offset="2" semantic="NORMAL" source="#0x8327AAA3_mat0_normals" />
<input offset="3" semantic="COLOR" source="#0x8327AAA3_mat0_colors" />
<p>0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 ... 312 313 313 313 313 314 314 314 314</p>
</triangles>
<triangles count="32" material="material1">
<input offset="0" semantic="VERTEX" source="#0x8327AAA3_vertices" />
<input offset="1" semantic="TEXCOORD" source="#0x8327AAA3_texcoords" />
<input offset="2" semantic="NORMAL" source="#0x8327AAA3_mat1_normals" />
<input offset="3" semantic="COLOR" source="#0x8327AAA3_mat1_colors" />
<p>315 315 0 0 316 316 1 1 317 317 ... 63 63 375 375 60 60</p>
</triangles>
</mesh>
</geometry>
Sorry, but I can't find anyone of the problems you reported in the <library_geometries> tag. Of course, I just used the input files
I have. If you found these errors when processing input files that I don't have, then it is obvious that I can't be aware of such problems...
Alanick wrote: ↑10 Nov 2022 20:28
i am beginning to believe now all the things i have read up until I've reached this forum, it seems it will be impossible to achieve this via dos batch
This type of comment is not good for casual users because they could think: "Yes, I heard several times that Batch files can't process xml files...", but they don't know the whole story! As I said before, although a Batch file is
not the best way to process .xml files in general, it is possible to develop a Batch file that can solve
your particular problem:
Aacini wrote: ↑02 Nov 2022 12:14
I suggest you to run my program with the same 3 data files you posted here and review the
output.txt generated file. If you could identify the problems in the output result, perhaps I could write a patch in the program to fix just those points. This way I would not write a general method to solve these complex type of problems with a Batch file, but just a specific Batch file that solve
your problem...
Please, be as clear as possible when you describe the problems with the actual program. You may post the specific line or section of the input data that cause problems, the output that is created now from such a data and the correct output you want. If the same type of problem appear several times, just describe it once. However, if a
different problem also appear in another part of the data, describe it in the same way.
...
Antonio
The problem with this approach is that it takes some time. I write a new version, you test it and find some errors. I write a new version that fix those errors, you test it and find new errors... Perhaps this cycle needs to be repeated several times more in order to finally solve your problem. This is not uncommon at all, given the complexity of the task to solve. What I tried to say is that even if someone use a programming language that "correctly" manage .xml files, don't expect to get a final solution in the first or second version of the code...
I'm sorry you gave up on solving this task...
Antonio