Started to pick this up again but it's just giving headache.
I thought with the above code it would be simple for me to get other items and link them to each other but i was wrong.
I wanted to get another item that isn't always available on all sections, example:
<SITE NAME="Microsoft" UID="4860BC398AA249E89453B69089CCBAC5">
<HOST>
ftp.microsoft.com
</HOST>
<NF>
True
</NF>
<AUTOREF ENABLE="False" />
<STATIC TOTAL="0" LAT="0" UP="0" DN="0" FXP="0" FXPD="0" />
<DISABLE>
True
</DISABLE>
</SITE>
; NEW BLOCK BEGINS
<SITE NAME="Sun" UID="2F5AF8E019F64286A864168372528990">
<HOST>
ftp.sun.com
</HOST>
</SITE>
Above is a snippet from 2 blocks, the first one (Microsoft), is disabled which i can tell because of this part (enabled sections don't have it)
<DISABLE>
True
</DISABLE>
So i thought extending code with a second item
alias xmltest {
var %file = xmltest.xml
filter -fk %file xmlhash *<site name=* uid=*>
filter -fk %file xmlhash *<disable*
}
alias xmlhash {
var %r = /<site name="(.+?)" uid="([\da-f]+?)">/i
var %r2 = /<disable="(.+?)" /i
if (!$regex($1,%r)) return
if (!$regex($1,%r2)) return
echo -a $regml(1)
}
But that was to easy for making it work so i did some reading but can't find proper documentation or examples on how to handle this.
Second thing i ran in to is sorting data, when i echo it to mirc it's sorted correctly but saving data to hash file for later use it's just random.