Hi,
I want to know what would be the best way to create metadata of an XML file with this format:
<?xml version="1.0" encoding="utf-8"?>
<django-objects version="1.0">
<object pk="8" model="auth.user">
<field type="CharField" name="username">jd</field>
<field type="CharField" name="first_name">John</field>
<field type="CharField" name="last_name">Doe</field>
<field type="CharField" name="email">bla@bla.com</field>
</object>
<object pk="2102684" model="auth.user">
<field type="CharField" name="username">kp</field>
<field type="CharField" name="first_name">Karl</field>
<field type="CharField" name="last_name">Row</field>
<field type="CharField" name="email">karl@test.com</field>
</object>
.... etc
</django-objects>
The problem here is that the <field> tag repeats multiple times (instead of having a separate <username>, <first_name>, etc tag), which causes the default metadata mapping to only return the first occurance (username).
How can I best map this kind of data?
Thanks for reply... If my xml is having more than one multiple elements of different names, like this:--
<FIXML xmlns="http://www.fixprotocol.org/FIXML-4-4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.fixprotocol.org/FIXML-4-4
fixml-positions-base-4-4.xsd" v="4.4" r="20030618" s="20031030">
<PosRpt RptID="541386431" Rslt="0" BizDt="2003-09-10T00:00:00" Acct="1" AcctTyp="1" SetPx="0;00" SetPxTyp="1" PriSetPx="0.00" ReqTyp="0" Ccy="USD">
<Hdr Snt="2001-12-17T09:30:47-05:00" PosDup="N" PosRsnd="N" SeqNum="1002">
<Sndr ID="String" Sub="String" Loc="String"/>
<Tgt ID="String" Sub="String" Loc="String"/>
<OnBhlfOf ID="String" Sub="String" Loc="String"/>
<DlvrTo ID="String" Sub="String" Loc="String"/>
</Hdr>
<Pty ID="OCC" R="21"/>
<Pty ID="99999" R="4"/>
<Pty ID="C" R="38">
<Sub ID="ZZZ" Typ="2"/>
</Pty>
<Qty Typ="SOD" Long="35" Short="0"/>
<Qty Typ="FIN" Long="20" Short="10"/>
<Qty Typ="IAS" Long="10"/>
<Amt Typ="FMTM" Amt="0.00"/>
<Instrmt Sym="AOL" ID="KW" IDSrc="J" CFI="OCASPS" MMY="20031122" Mat="2003-11-22T00:00:00" Strk="47.50" StrkCcy="USD" Mult="100"/>
</PosRpt>
</FIXML>
In this xml, as you see <Pty> and <Qty> are repeated tags..
so, i want to create metadata (table schema) and loop path query for this xml and fetch all data from it.. and i want to iterate both these tags also.. and what component are you using in your screenshot...
Thanks
Shikha
styagi@kailaz.com
Hi It is impossible to read all tags, including the repeated tags, in a tFileInputXML. As a workaround, use several tfileinputXML to read different tags and then do join on tMap, for exmaple: tFileInputXML_1: set Pty as loop element, get values of RptID and ID, R. tFileInputXML_2: set Qty as loop element, get values of RptID, Typ, Long, Short. tFileInputXML_3: set PosRpt as loop element, get values of RptID and the rest of tags and attributes. and then do an inner join on tmap on RptID.
and what component are you using in your screenshot...
I am creating xml metadata in Repository/Metadata/File XML. As a newbie, you must learn how to create a metadata follows wizards.