Thread: [Servingxml-help] xml->flat repeatingGroup
Brought to you by:
danielaparker
From: Ravikumar T. <ra...@gm...> - 2007-04-16 01:18:16
|
Daniel Trying a case in xml to flat. Flat file record needs a repeating group. The input xml is of the following form. There could be any number of compositeA elements and any number of compositeB elements. Expected output is given below. Since the # of compositeA is unknown I am trying to use <sx:repeatingGroup> in the flat file recordType. But it doesnot seem to recognize it. Can you please help with this. <all> <field1>val1</field1> <field2>val2</field2> <field3>val3</field3> <compositeA attr1="av11" attr2="av21" attr3="av31"/> <compositeA attr1="av21" attr2="av22" attr3="av23"/> <compositeA attr1="av31" attr2="av32" attr3="av33"/> <compositeB attrx="avx" attry="avy"/> </all> Expected Output: val1 val2 val3 av11 av21 av31 av21 av22 av23 av31 av32 av33 avx avy <sx:flatRecordType id="allType" name="allType"> <sx:positionalField name="f1" label="F1" width="10"/> <sx:positionalField name="f2" label="F2" width="10"/> <sx:positionalField name="f3" label="F3" width="10"/> <sx:repeatingGroup name="compA"> <sx:flatRecordType name="compARecord"> <sx:positionalField name="ca1" width="5"/> <sx:positionalField name="ca2" width="5"/> <sx:positionalField name="ca3" width="5"/> </sx:flatRecordType> </sx:repeatingGroup> <sx:repeatingGroup name="compB"> <sx:flatRecordType name="compBRecord"> <sx:positionalField name="cb1" width="5"/> <sx:positionalField name="cb2" width="5"/> </sx:flatRecordType> </sx:repeatingGroup> </sx:flatRecordType> <sx:inverseRecordMapping id="allToFileMapping"> <sx:onSubtree path="/all"> <sx:subtreeRecordMap recordType="allType"> <sx:subtreeFieldMap select="field1" field="f1"/> <sx:subtreeFieldMap select="field2" field="f2"/> <sx:subtreeFieldMap select="field3" field="f3"/> <sx:onSubtree path="compositeA"> <sx:subtreeRecordMap recordType="compARecord"> <sx:subtreeFieldMap select="@attr1" field="ca1"/> <sx:subtreeFieldMap select="@attr2" field="ca2"/> <sx:subtreeFieldMap select="@attr3" field="ca3"/> </sx:subtreeRecordMap> </sx:onSubtree> <sx:onSubtree path="compositeB"> <sx:subtreeRecordMap recordType="compBRecord"> <sx:subtreeFieldMap select="@attrx" field="cb1"/> <sx:subtreeFieldMap select="@attry" field="cb2"/> </sx:subtreeRecordMap> <sx:onSubtree> </sx:subtreeRecordMap> </sx:onSubtree> </sx:inverseRecordMapping> |
From: Daniel P. <dan...@sy...> - 2007-04-30 03:52:35
|
Ravi, This is now supported in version 0.6.6, see the XML to Flat example "XML = to Flat Repeating Group (all)" -- Daniel ----- Original Message -----=20 From: Ravikumar Tadysetty=20 To: Daniel Parker=20 Sent: Sunday, April 15, 2007 9:17 PM Subject: [Servingxml-help] xml->flat repeatingGroup Daniel Trying a case in xml to flat. Flat file record needs a repeating = group. The input xml is of the following form. There could be any number = of compositeA elements and any number of compositeB elements. Expected = output is given below. Since the # of compositeA is unknown I am trying = to use <sx:repeatingGroup> in the flat file recordType. But it doesnot = seem to recognize it. Can you please help with this.=20 <all> <field1>val1</field1> <field2>val2</field2> <field3>val3</field3> <compositeA attr1=3D"av11" attr2=3D"av21" attr3=3D"av31"/>=20 <compositeA attr1=3D"av21" attr2=3D"av22" attr3=3D"av23"/> <compositeA attr1=3D"av31" attr2=3D"av32" attr3=3D"av33"/> <compositeB attrx=3D"avx" attry=3D"avy"/>=20 </all> Expected Output: val1 val2 val3 av11 av21 av31 av21 av22 av23 av31 = av32 av33 avx avy =20 <sx:flatRecordType id=3D"allType" name=3D"allType"> <sx:positionalField name=3D"f1" label=3D"F1" width=3D"10"/>=20 <sx:positionalField name=3D"f2" label=3D"F2" width=3D"10"/> <sx:positionalField name=3D"f3" label=3D"F3" width=3D"10"/> <sx:repeatingGroup name=3D"compA">=20 <sx:flatRecordType name=3D"compARecord"> <sx:positionalField name=3D"ca1" width=3D"5"/> <sx:positionalField name=3D"ca2" width=3D"5"/>=20 <sx:positionalField name=3D"ca3" width=3D"5"/> </sx:flatRecordType> =20 </sx:repeatingGroup> <sx:repeatingGroup name=3D"compB"> <sx:flatRecordType name=3D"compBRecord"> <sx:positionalField name=3D"cb1" width=3D"5"/> <sx:positionalField name=3D"cb2" width=3D"5"/> </sx:flatRecordType> =20 </sx:repeatingGroup> </sx:flatRecordType> <sx:inverseRecordMapping id=3D"allToFileMapping"> <sx:onSubtree path=3D"/all"> <sx:subtreeRecordMap recordType=3D"allType">=20 <sx:subtreeFieldMap select=3D"field1" field=3D"f1"/> <sx:subtreeFieldMap select=3D"field2" field=3D"f2"/> <sx:subtreeFieldMap select=3D"field3" field=3D"f3"/>=20 <sx:onSubtree path=3D"compositeA"> <sx:subtreeRecordMap recordType=3D"compARecord"> <sx:subtreeFieldMap select=3D"@attr1" = field=3D"ca1"/>=20 <sx:subtreeFieldMap select=3D"@attr2" = field=3D"ca2"/> <sx:subtreeFieldMap select=3D"@attr3" = field=3D"ca3"/> </sx:subtreeRecordMap>=20 </sx:onSubtree> <sx:onSubtree path=3D"compositeB"> <sx:subtreeRecordMap recordType=3D"compBRecord"> <sx:subtreeFieldMap select=3D"@attrx" = field=3D"cb1"/> <sx:subtreeFieldMap select=3D"@attry" = field=3D"cb2"/> </sx:subtreeRecordMap> <sx:onSubtree> </sx:subtreeRecordMap> </sx:onSubtree> </sx:inverseRecordMapping> -------------------------------------------------------------------------= ----- = -------------------------------------------------------------------------= This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ -------------------------------------------------------------------------= ----- _______________________________________________ Servingxml-help mailing list Ser...@li... https://lists.sourceforge.net/lists/listinfo/servingxml-help |