[thelist] xml and classic asp

der wert derwert at hotmail.com
Mon Jul 31 18:12:39 CDT 2006

just for completeness, for future ref. if anyone asks the same question but 
for php instead of asp, you can refer the individual to this message
note: the $data variable can easily be replace with a post object as was 
from the orig. query
it would be done like so $data=$_POST['name_of_xml_data_variable'];
this code parses the data and creates an array with the data in it which can 
easily be accesssed
$data= "

preg_match_all("|<([^>]+)>(.*)</[^>]+>|U", $data, $out, PREG_SET_ORDER);
$c =0; $number_of_entries = (count($out)/7);

for ($a = 1; $a <= $number_of_entries; $a++){
	for ($b = 0; $b <= 6; $b++){

//display array struct and data, for example purposes
print_r ($ndata);

//example of accessing data(accesses the first record of ConsigneeName)
echo $ndata[1]['ConsigneeName']."\n";

//accesses the second record of AddressLine
echo $ndata[2]['AddressLine']."\n";


the end result would be an array that looks like this:

    [1] => Array
            [ConsigneeName] => data1a
            [AddressLine] => data2a
            [PoliticalDivision2] => data3a
            [PoliticalDivision1] => data4a
            [PostcodePrimaryLow] => data5a
            [PostcodeExtendedLow] => data6a
            [CountryCode] => data7a

    [2] => Array
            [ConsigneeName] => data1b
            [AddressLine] => data2b
            [PoliticalDivision2] => data3b
            [PoliticalDivision1] => data4b
            [PostcodePrimaryLow] => data5b
            [PostcodeExtendedLow] => data6b
            [CountryCode] => data7b


Don’t just search. Find. Check out the new MSN Search! 

More information about the thelist mailing list