jeu. 28 juillet 2011, 23h12
Thierry
atoutfox.public.association
Re: Transformer un fichier xml en un cursor vfp ( avec son fichier de structure xsd)
Bonjour,
Pas de solution simple. Il faut créer la structure des données (curseurs),
puis "mapper" correctement les noms DBF avec les noms XML, en respectant
Maj/Min
oXA = CREATEOBJECT("XmlAdapter")
oXA.LoadXML( 'MR.xml',.T.)
CREATE CURSOR group (group_id i, group_Name c(30))
oXA.AddTableSchema('group')
oXA.tables(1).fields(1).xmlName = Strconv('group-id',12)
oXA.tables(1).fields(2).xmlName = Strconv('group-Name',12)
oXa.tables(1).toCursor(.t.)
CREATE CURSOR Staff(Staff_id i, Staff_code i, Staff_fname c(30), Staff_lname
c(30), group_id i)
oXA.AddTableSchema('staff',.t.,STRCONV('Staff',12))
oXA.tables(2).fields(1).xmlName = Strconv('Staff-id',12)
oXA.tables(2).fields(2).xmlName = Strconv('Staff-code',12)
oXA.tables(2).fields(3).xmlName = Strconv('Staff-fname',12)
oXA.tables(2).fields(4).xmlName = Strconv('Staff-lname',12)
oXA.tables(2).fields(5).xmlName = Strconv('group-id',12)
oXa.tables(2).toCursor(.t.)
....
Permalink : http://www.atoutfox.org/nntp.asp?ID=0000006517