I tried defining the arrays in the function before the loop, but that 
didn't work either. It only works if I define them outside the function.

For more context, I'm parsing data from an ATOM feed. There are several 
different types of records, each with a slightly different structure. I'm 
only interested in two types of records - Subset1 and Subset2. Perhaps a 
better phrasing would be recordtype1 and recordtype2.
Think of it this way:

df_outer = DataFrame(types,names,0)   # a dataframe to collect all values 
for a file
df_inner = DataFrame(type,name,1)   # a one row dataframe to collect values 
for each row of a file

recordtype1 = xpath(pg, path_to_recordtype1)      # creates an array of 
these elements)
for e in recordtype1
  df_inner[:field1] = LibExpat.find(e,path_to_subelement)
  etc. etc.
  append!(df_inner, df_outer)
end

[similar code for recordtype2]

source = dfconvert(dfall) [note: Data.Table(dfall) doesn't work for me, but 
I copied the Data.Table(df) function from DataStreams.jl and it works]
Data.stream!(source, sink)
end

I use the recordtype1 and recordtype2 arrays to simplify the code. Rather 
than use a series of if-then statements to filter out the recordtypes I 
don't want, I create two arrays of the records I do want and then loop 
through them.




On Monday, January 11, 2016 at 8:53:43 PM UTC-5, Eric Forgy wrote:
>
> Hi Brandon,
>
> That psuedo code is a little too "pseudo" for me, so I don't fully 
> understand what you're trying to do, but you might try defining subset1 and 
> subset1 in the function, but just before the "for url" loop.
>

Reply via email to