Hi Devon, I think you are prematurely over-optimising and losing patience. If make you code more sparse, you'll see the results coming and get more confidence.
As a starting point, take the rss example and gradually replace the RSS elements with your elements, and you will see the result smoutput on screen. Then gradually form your output data structures, making sure it does not fall apart. Your data is relational, so you can cache field values in individual named nouns in character handler if. ... do. msci_index_code=: y and then collect them into record tables in endElement handler. You'll be fine. Let me know if you have more questions. --- On Sat, 5/31/08, Devon McCormick <[EMAIL PROTECTED]> wrote: > I've got XML and code to parse it, for example: > > require 'xml/sax/sax' > saxclass 'psax2' > > startDocument=: 3 : 0 > L=: 0 > BAD_base_=: IXNM_base_=: IXV_base_=: '' > PDV_base_=: ATR_base_=: 0 0$<'' > PD=: '' > PDNMS=: > 'performance_date';'index_return';'index_value';'num_constituents';'index_assets' > ) > > startElement=: 4 : 0 > L=: L+1 > select. y > case. 'index' do. > if. 0~:#IXV_base_ do. ATR_base_=: ATR_base_,IXV_base_ > IXV_base_=: a:$~#IXNM_base_ end. > case. 'performance_data' do. PD=: > a:$~>:#PDNMS > case. PDNMS do. PD=: (<x) (PDNMS i. y)}PD > case. IXNM_base_ do. IXV_base_=: (<x) (IXNM_base_ i. > y)}IXV_base_ > case. do. IXNM_base_=: IXNM_base_,<y[IXV_base_=: > IXV_base_,<x > end. > ) > > endElement=: 3 : 0 > L=: L-1 > select. y > fcase. 'index' do. ATR_base_=: > ATR_base_,IXV_base_ > IXV_base_=: a:$~#IXNM_base_ > case. 'performance_data' do. PDV_base_=: > PDV_base_,PD > PD=: a:$~>:#PDNMS NB. Unknowns at end. > case. PDNMS do. > case. IXNM_base_ do. smoutput y > case. do. BAD_base_=: BAD_base_,<y > end. > ) > > sampleIx1=: 0 : 0 > <?xml version='1.0' > encoding='ISO-8859-1'?> > <MSCIHedgeFundIndexInfo ExtractDate='2008/05/26' > ExtractTime='06:37:51'> > <index> > <msci_index_code>900671</msci_index_code> > <indexname>Discretionary Trading</indexname> > <inceptiondate>2001/12/31</inceptiondate> > <inceptionvalue>1000</inceptionvalue> > <performance_data> > > <performance_date>1994/01/31</performance_date> > <index_return>-0.003838</index_return> > <index_value>401.710</index_value> > <num_constituents>9</num_constituents> > <index_assets>527853620</index_assets> > </performance_data> > <performance_data> > > <performance_date>1994/02/28</performance_date> > <index_return>-0.005904</index_return> > <index_value>399.338</index_value> > <num_constituents>9</num_constituents> > <index_assets>532669357</index_assets> > </performance_data> > </index> > </MSCIHedgeFundIndexInfo> > ) > > I get results like this: > > IXV_base_ > ++++++ > |||||| > ++++++ > ATR_base_ > +--------+--------+--------+--------+--------+ > |51799256| | | | | > +--------+--------+--------+--------+--------+ > | |51799256|51799256|51799256|51799256| > +--------+--------+--------+--------+--------+ > BAD_base_ > > PDV_base_ > ++++++--------+ > ||||||51799256| > ++++++--------+ > ||||||51799256| > ++++++--------+ > |||||| | > ++++++--------+ > > On more extensive data, I got similar results but with a > slightly different > long number (which looks like it might be a pointer value > or something). > > Anyway, I'm completely confused and thought it might be > clearer with another > package. > > Thanks, > > Devon > > > > On 5/31/08, Oleg Kobchenko <[EMAIL PROTECTED]> wrote: > > > > For some apps XSLT is better. What sort of trouble? > > > > > > > > --- On Thu, 5/29/08, Devon McCormick > <[EMAIL PROTECTED]> wrote: > > > > > Members of the Forum - > > > > > > has anyone used the XML addon "sax"? > I'm > > > having trouble with it. Is "xlst" > > > better? > > > > > > Thanks, > > > > > > Devon > > > > > > -- > > > Devon McCormick, CFA > > > ^me^ at acm. > > > org is my > > > preferred e-mail > > > > > > ---------------------------------------------------------------------- > > > For information about J forums see > > > http://www.jsoftware.com/forums.htm > > > > > > > > > ---------------------------------------------------------------------- > > For information about J forums see > http://www.jsoftware.com/forums.htm > > > > > > -- > Devon McCormick, CFA > ^me^ at acm. > org is my > preferred e-mail > ---------------------------------------------------------------------- > For information about J forums see > http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
