XML problem with my Config file

Just starting out? Need help? Post your questions and find answers here.
User avatar
mk-soft
Always Here
Always Here
Posts: 6320
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: XML problem with my Config file

Post by mk-soft »

I've been using XML instead of INI for a long time ...

Link: viewtopic.php?t=74233
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
GenRabbit
Enthusiast
Enthusiast
Posts: 151
Joined: Wed Dec 31, 2014 5:41 pm

Re: XML problem with my Config file

Post 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.
infratec
Always Here
Always Here
Posts: 7662
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: XML problem with my Config file

Post by infratec »

Same as in JSON:

ExtractXMLStructure(Knoten, *Puffer, Struktur [, Flags])
GenRabbit
Enthusiast
Enthusiast
Posts: 151
Joined: Wed Dec 31, 2014 5:41 pm

Re: XML problem with my Config file

Post 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?
Post Reply