Results 1 to 8 of 8

Thread: XML from 2 dimention array

  1. #1

    Thread Starter
    Lively Member reado's Avatar
    Join Date
    Mar 2005
    Posts
    78

    XML from 2 dimention array

    Hi I have a two dementioned array ie myArray(10,10).

    How can I create XML quickly from the values in this array without looping round the array?

    Thanks
    Paul

  2. #2

  3. #3
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: XML from 2 dimention array

    In other words, even if there is a function that does this, internally, it's still using loops...

    This type of question is asked a lot latelly.... that the anser is obvious... if there is something with many items... it means you need a loop.

  4. #4
    Addicted Member
    Join Date
    Jul 2007
    Posts
    234

    Re: XML from 2 dimention array

    you can create a CSV file, which can be opened by excel
    Code:
    Open "myfile.csv" For Output As #1
    For i = 0 To UBound(the_array)
     Print #1, the_array(i, 0), ",", the_array(i, 1), ",", the_array(i, 2), ",",  the_array(i, 3), ",", the_array(i, 4), ",", the_array(i, 5), ",", the_array(i, 6), ",", the_array(i, 7), ",", the_array(i, 8), ",", the_array(i, 9)
    Next i
    Close #1
    each Print statement prints a new line in the file

  5. #5
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: XML from 2 dimention array

    Quote Originally Posted by unxzst
    you can create a CSV file, which can be opened by excel
    Code:
    Open "myfile.csv" For Output As #1
    For i = 0 To UBound(the_array)
     Print #1, the_array(i, 0), ",", the_array(i, 1), ",", the_array(i, 2), ",",  the_array(i, 3), ",", the_array(i, 4), ",", the_array(i, 5), ",", the_array(i, 6), ",", the_array(i, 7), ",", the_array(i, 8), ",", the_array(i, 9)
    Next i
    Close #1
    each Print statement prints a new line in the file
    Of course there are many ways to do what he wants but he stated "without looping round the array".

  6. #6
    Addicted Member
    Join Date
    Jul 2007
    Posts
    234

    Re: XML from 2 dimention array

    Quote Originally Posted by MartinLiss
    Of course there are many ways to do what he wants but he stated "without looping round the array".
    oh LOL you're right, i should pay more attention.
    let me know if you guys find a way

  7. #7
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: XML from 2 dimention array

    You could write out the area of memory the array resides in but a) it's really still looping around the array, just in a different way and b) the resultant file would probably need some heavy coding to read.

    You CAN scratch your left elbow with your left hand, but the medical bills, pain and recovery time for a broken arm make scratching it with your right hand much more sensible.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  8. #8

    Thread Starter
    Lively Member reado's Avatar
    Join Date
    Mar 2005
    Posts
    78

    Re: XML from 2 dimention array

    Ok thanks for your help anyway.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width