Re: [Servingxml-help] pos file repeating sections to nested XML
Brought to you by:
danielaparker
From: Brewer, K. <ken...@pe...> - 2005-11-27 03:51:35
|
Daniel, There is no delimiter to identify the end of a repeating group in my file. Instead, the documentation for the import file indicates how many times a group repeats and suggests doing the math to determine where the repeating group ends. For example, if the address section repeats 10 times, then the whole repeating group is 90 characters wide(based on my example record below) and the next normal field begins after that. It seems like the pattern matching approach could be buggy i.e. if the repeating group fields and the subsequent normal field(to match on) were all numbers i.e. 19721964 where 1-2 and 3-4 are fields of a 2 field repeating group but 5-8 is a normal field. Ideally though, it would be nice if there was a more finite way i.e. if the repeatingGroup element honored an attribute such as 'count="10"'. The example I gave below is not my exact record layout and I have several files with similar problems. I will take a second look at the docs for them, maybe the datatypes of the fields adjacent to the repeating group are different than the repeating group such that pattern matching would work reliably. Can servingxml perform multiple passes e.g. if we know that address repeats 10 times for a total of 90 characters, can we parse it out as one 90 character field then, in a 2nd pass, parse that as a separate record where the whole record is one repeating group? Even if servingxml doesn't support this directly, it seems like it could be done by driving servingxml from Java(embedded mode) with multiple resource scripts(or services) by passing the 1st service the whole record, then passing the 90 character address group to a 2nd service, and so on. Maybe more work and less ideal but still much better than writing the whole thing myself! Thanks again, Ken > Ken, > > Currently, support is limited to a single repeating group at the tail of a > record. The items in the group may be heterogenous and have different > record types, if a test evaluated against the leading fields of an item can > reveal the type, see the segments example. But that doesn't cover your case > below. > > Mixing multiple repeating groups with fields means we need to be able to > determine where the group ends. One way is to allow repeating groups to be > separated by field delimiters (we actually support that with an older, no > longer documented, approach), but that also won't cover your case below. > Your case would require separating repeating groups based on pattern matching on a field, in particular, a field recognizable as a year field. > > Can you just confirm that in your requirements, there is no delimiter as > such to identify the end of the group, but that the end must be determined > by characteristics of the next field value? > > Thanks, > Daniel ----- Original Message ----- From: "Brewer, Ken" <ken...@pe...> To: <ser...@li...>; "'Daniel Parker '" <dan...@sy...> Sent: Saturday, November 26, 2005 2:15 PM Subject: Re: [Servingxml-help] pos file repeating sections to nested XML > Thanks for such prompt response and solution! I'll try the new release. > The > workaround script you provided worked perfectly. That leads to me another > question - big surprise huh. What if there are multiple repeating sections > scattered throughout the record - how do I specify how many times it > repeats > or where it ends and regular fields start again? > > Here's an example of the record with soI've me attempted ascii-art > annotation(view with non-truetype font), the actual record begins with > 'JANE'. > > S | > T | > R | > U | > C | > T |----------------------------------------- > U || |(repeating)| | |(repeating) > R || |-----------| | |---------------- > E || | | | | | | | | | | > --|JANEENGLC-MATHA+1972BLUECHICAGOILATLANTAGA > F || | | | | | | | | | | > I |N S G S G Y C C S C S > E |a u r u r e o i t i t > L |m b a b a a l t a t a > D |e j d j d r o y t y t > S | e e e e B r e e > | c c o > | t t r > | n > > > example disired output: > > <StudentGrades> > <StudentGrade> > <Name>JANE</Name> > <SubjectGrade> > <Subject>ENGL</Subject> > <Grade>C-</Grade> > </SubjectGrade> > <SubjectGrade> > <Subject>MATH</Subject> > <Grade>A+</Grade> > </SubjectGrade> > <YearBorn>1972</YearBorn> > <Color>BLUE</FavoriteColor> > <Address> > <City>CHICAGO</City> > <State>IL</City> > </Address> > <Address> > <City>ATLANTA</City> > <State>GA</City> > </Address> > </StudentGrade> > <StudentGrade> > <!-- this 2nd record omitted for brevity --> > </StudentGrade> > </StudentGrades> > > Thanks again, > > -Ken > **************************************************************************** This email may contain confidential material. If you were not an intended recipient, Please notify the sender and delete all copies. We may monitor email to and from our network. **************************************************************************** |