Page 2 of 2

Re: XML problem with my Config file

Posted: Tue Nov 12, 2024 6:50 pm
by mk-soft
I've been using XML instead of INI for a long time ...

Link: viewtopic.php?t=74233

Re: XML problem with my Config file

Posted: Mon Nov 18, 2024 1:08 am
by GenRabbit
Thanks for all the help. I've no written a part to parse a json file. Quite easy when I found a huge json file example somewhere on this forum.
But how would I parse this?

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>

<Ini_Structure>
  <MinutesFromTheBeginning>233335017</MinutesFromTheBeginning>
  <MonthsInYear>14</MonthsInYear>
  <HourInDay>24</HourInDay>
  <MinutesInHour>60</MinutesInHour>
  <DaysInWeek>8</DaysInWeek>
  <NameOfDays>
    <element>Morrasday</element>
    <element>Nirmoday</element>
    <element>Yranday</element>
    <element>Janmarday</element>
    <element>Turenday</element>
    <element>Ermaday</element>
    <element>Ulvakday</element>
    <element>Cortenday</element>
  </NameOfDays>
  <NameOfMonths>
    <element>Solan</element>
    <element>Dellios</element>
    <element>Rande</element>
    <element>Varian</element>
    <element>Mosicante</element>
    <element>Uliande</element>
    <element>Horitan</element>
    <element>Belizadore</element>
    <element>Koloss</element>
    <element>Jarajan</element>
    <element>Polokk</element>
    <element>Quartani</element>
    <element>Romante</element>
    <element>Morvika</element>
  </NameOfMonths>
  <DaysInMonths>
    <element>24</element>
    <element>26</element>
    <element>26</element>
    <element>33</element>
    <element>32</element>
    <element>32</element>
    <element>29</element>
    <element>32</element>
    <element>31</element>
    <element>27</element>
    <element>32</element>
    <element>28</element>
    <element>28</element>
    <element>26</element>
  </DaysInMonths>
</Ini_Structure>
I got this far;

Code: Select all

Result = LoadXML(#PB_Any,XFilename)
FreeXML(Result)
then I had no idea, and the help file is not much helpful when I have no idea, what is Child, Parent Node and so on.

Re: XML problem with my Config file

Posted: Mon Nov 18, 2024 7:55 am
by infratec
Same as in JSON:

ExtractXMLStructure(Knoten, *Puffer, Struktur [, Flags])

Re: XML problem with my Config file

Posted: Mon Nov 18, 2024 11:55 pm
by GenRabbit
Thanks, didn't even know of ExtractJSONStructure, used a lot of code to parse the file, then ExtractXMLStructure appeared and all my code could just be deleted.. ;)
Is there a Command like this For INIFile aswell?