Page 1 sur 1

[Résolu] Demande d'aide pour traiter du xml complexe

Posté : 02 juil. 2010, 15:47
par cedy
Bonjour,
Après une semaine de bug, je me décide enfin a vous demander de l'aide :)

J'ai un fichier xml

Code : Tout sélectionner

<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?> <feed xml:base="http://cat.internetbrokerproject.be/IBPCatalog.V4/Feed/CatalogAtomFeed.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom"> <title type="text">DigestedCatalogItems</title> <id>http://cat.internetbrokerproject.be/ibpcatalog.v4/Feed/CatalogAtomFeed.svc/DigestedCatalogItems</id> <updated>2010-07-02T13:28:08Z</updated> <link rel="self" title="DigestedCatalogItems" href="DigestedCatalogItems" /> <entry> <id>http://cat.internetbrokerproject.be/IBPCatalog.V4/Feed/CatalogAtomFeed.svc/DigestedCatalogItems('Assurance%20Auto%20Top%20Conducteur')</id> <title type="text"></title> <updated>2010-07-02T13:28:08Z</updated> <author> <name /> </author> <link rel="edit" title="DigestedCatalogItems" href="DigestedCatalogItems('Assurance%20Auto%20Top%20Conducteur')" /> <category term="IBP.CatalogModel.DigestedCatalogItems" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> <content type="application/xml"> <m:properties> <d:Url>http://www.portalpack.aginsurance.be/sites/ibp/SiteCollectionImages/Auto/auto-top-conducteur-728x90_f.jpg</d:Url> <d:CalculatedUrl>http://www.portalpack.aginsurance.be/sites/ibp/SiteCollectionImages/Auto/auto-top-conducteur-728x90_f.jpg</d:CalculatedUrl> <d:Language>FR</d:Language> <d:Description>Banner 728x90_f Top Conducteur</d:Description> <d:DescriptionLong m:null="true" /> <d:CompanyCode>0079</d:CompanyCode> <d:CompanyName>AG Insurance</d:CompanyName> <d:ProductName>Assurance Auto Top Conducteur</d:ProductName> <d:ProductDomainCodeKey>X916-05</d:ProductDomainCodeKey> <d:ProductDomainCodeDescription>Auto</d:ProductDomainCodeDescription> <d:TargetKey>PERSONAL</d:TargetKey> <d:CategoryKey>IBPC-02</d:CategoryKey> <d:CategoryDescription>Commerciële informatie over producten</d:CategoryDescription> <d:SubCategoryKey>IBPSC-15</d:SubCategoryKey> <d:SubCategoryDescription>Banner zonder link</d:SubCategoryDescription> <d:DisplayModeKey>FIXED_TB2_IAB</d:DisplayModeKey> <d:DisplayModeDescription>Fixed size (Telebib2 subset of IAB standard)</d:DisplayModeDescription> <d:FriendlySizeKey>IAB UAP Leaderboard (728 x 90)</d:FriendlySizeKey> <d:Width m:type="Edm.Int32">728</d:Width> <d:Height m:type="Edm.Int32">90</d:Height> <d:ProductValidity>NoLimit</d:ProductValidity> <d:ProductVisibleFrom m:type="Edm.DateTime" m:null="true" /> <d:ProductVisibleUntil m:type="Edm.DateTime" m:null="true" /> <d:ItemValidity>NoLimit</d:ItemValidity> <d:ItemVisibleFrom m:type="Edm.DateTime" m:null="true" /> <d:ItemVisibleUntil m:type="Edm.DateTime" m:null="true" /> <d:BrokerComments m:null="true" /> <d:CatalogItemGuid xml:space="preserve">9D4F95E2-E2E9-4252-AD35-74F746A8660E </d:CatalogItemGuid> <d:ProductGuid xml:space="preserve">7B773056-357A-4B14-A904-ECEE6396A571 </d:ProductGuid> <d:CatalogGuid xml:space="preserve">DCF00761-E092-442A-9008-AFB1F9027ACE </d:CatalogGuid> <d:SecureGuid xml:space="preserve">4F952499-E8BB-4C07-AE2E-76E398D7D8EF </d:SecureGuid> </m:properties> </content> </entry> <entry> <id>http://cat.internetbrokerproject.be/IBPCatalog.V4/Feed/CatalogAtomFeed.svc/DigestedCatalogItems('Assurance%20Protection%20Juridique%20Auto')</id> <title type="text"></title> <updated>2010-07-02T13:28:08Z</updated> <author> <name /> </author> <link rel="edit" title="DigestedCatalogItems" href="DigestedCatalogItems('Assurance%20Protection%20Juridique%20Auto')" /> <category term="IBP.CatalogModel.DigestedCatalogItems" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> <content type="application/xml"> <m:properties> <d:Url>http://www.portalpack.aginsurance.be/sites/ibp/SiteCollectionImages/Auto/auto-protection-juridique-728x90_f.jpg</d:Url> <d:CalculatedUrl>http://www.portalpack.aginsurance.be/sites/ibp/SiteCollectionImages/Auto/auto-protection-juridique-728x90_f.jpg</d:CalculatedUrl> <d:Language>FR</d:Language> <d:Description>Banner 728x90_f Protection Juridique Auto</d:Description> <d:DescriptionLong m:null="true" /> <d:CompanyCode>0079</d:CompanyCode> <d:CompanyName>AG Insurance</d:CompanyName> <d:ProductName>Assurance Protection Juridique Auto</d:ProductName> <d:ProductDomainCodeKey>X916-05</d:ProductDomainCodeKey> <d:ProductDomainCodeDescription>Auto</d:ProductDomainCodeDescription> <d:TargetKey>PERSONAL</d:TargetKey> <d:CategoryKey>IBPC-02</d:CategoryKey> <d:CategoryDescription>Commerciële informatie over producten</d:CategoryDescription> <d:SubCategoryKey>IBPSC-15</d:SubCategoryKey> <d:SubCategoryDescription>Banner zonder link</d:SubCategoryDescription> <d:DisplayModeKey>FIXED_TB2_IAB</d:DisplayModeKey> <d:DisplayModeDescription>Fixed size (Telebib2 subset of IAB standard)</d:DisplayModeDescription> <d:FriendlySizeKey>IAB UAP Leaderboard (728 x 90)</d:FriendlySizeKey> <d:Width m:type="Edm.Int32">728</d:Width> <d:Height m:type="Edm.Int32">90</d:Height> <d:ProductValidity>NoLimit</d:ProductValidity> <d:ProductVisibleFrom m:type="Edm.DateTime" m:null="true" /> <d:ProductVisibleUntil m:type="Edm.DateTime" m:null="true" /> <d:ItemValidity>NoLimit</d:ItemValidity> <d:ItemVisibleFrom m:type="Edm.DateTime" m:null="true" /> <d:ItemVisibleUntil m:type="Edm.DateTime" m:null="true" /> <d:BrokerComments m:null="true" /> <d:CatalogItemGuid xml:space="preserve">647AA29C-C7BB-42F1-99AC-51C4CC7203BF </d:CatalogItemGuid> <d:ProductGuid xml:space="preserve">649DF88B-140A-462D-A3ED-C816B8C5C276 </d:ProductGuid> <d:CatalogGuid xml:space="preserve">DCF00761-E092-442A-9008-AFB1F9027ACE </d:CatalogGuid> <d:SecureGuid xml:space="preserve">4F952499-E8BB-4C07-AE2E-76E398D7D8EF </d:SecureGuid> </m:properties> </content> </entry> <entry> <id>http://cat.internetbrokerproject.be/IBPCatalog.V4/Feed/CatalogAtomFeed.svc/DigestedCatalogItems('Formule%2024%20Vie%20priv%C3%A9e')</id> <title type="text"></title> <updated>2010-07-02T13:28:08Z</updated> <author> <name /> </author> <link rel="edit" title="DigestedCatalogItems" href="DigestedCatalogItems('Formule%2024%20Vie%20priv%C3%A9e')" /> <category term="IBP.CatalogModel.DigestedCatalogItems" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> <content type="application/xml"> <m:properties> <d:Url>http://www.portalpack.aginsurance.be/sites/ibp/SiteCollectionImages/Familiale/familiale-formule24-728x90_f.jpg</d:Url> <d:CalculatedUrl>http://www.portalpack.aginsurance.be/sites/ibp/SiteCollectionImages/Familiale/familiale-formule24-728x90_f.jpg</d:CalculatedUrl> <d:Language>FR</d:Language> <d:Description>Banner 728x90_f Formule 24 Vie privée</d:Description> <d:DescriptionLong m:null="true" /> <d:CompanyCode>0079</d:CompanyCode> <d:CompanyName>AG Insurance</d:CompanyName> <d:ProductName>Formule 24 Vie privée</d:ProductName> <d:ProductDomainCodeKey>X916-02</d:ProductDomainCodeKey> <d:ProductDomainCodeDescription>Individuele</d:ProductDomainCodeDescription> <d:TargetKey>PERSONAL</d:TargetKey> <d:CategoryKey>IBPC-02</d:CategoryKey> <d:CategoryDescription>Commerciële informatie over producten</d:CategoryDescription> <d:SubCategoryKey>IBPSC-15</d:SubCategoryKey> <d:SubCategoryDescription>Banner zonder link</d:SubCategoryDescription> <d:DisplayModeKey>FIXED_TB2_IAB</d:DisplayModeKey> <d:DisplayModeDescription>Fixed size (Telebib2 subset of IAB standard)</d:DisplayModeDescription> <d:FriendlySizeKey>IAB UAP Leaderboard (728 x 90)</d:FriendlySizeKey> <d:Width m:type="Edm.Int32">728</d:Width> <d:Height m:type="Edm.Int32">90</d:Height> <d:ProductValidity>NoLimit</d:ProductValidity> <d:ProductVisibleFrom m:type="Edm.DateTime" m:null="true" /> <d:ProductVisibleUntil m:type="Edm.DateTime" m:null="true" /> <d:ItemValidity>NoLimit</d:ItemValidity> <d:ItemVisibleFrom m:type="Edm.DateTime" m:null="true" /> <d:ItemVisibleUntil m:type="Edm.DateTime" m:null="true" /> <d:BrokerComments m:null="true" /> <d:CatalogItemGuid xml:space="preserve">FD3D2366-6433-4A03-B0D8-45056BB8C4E9 </d:CatalogItemGuid> <d:ProductGuid xml:space="preserve">B8C72502-96B1-4878-93D3-2251580CDA07 </d:ProductGuid> <d:CatalogGuid xml:space="preserve">DCF00761-E092-442A-9008-AFB1F9027ACE </d:CatalogGuid> <d:SecureGuid xml:space="preserve">4F952499-E8BB-4C07-AE2E-76E398D7D8EF </d:SecureGuid> </m:properties> </content> </entry> <entry> <id>http://cat.internetbrokerproject.be/IBPCatalog.V4/Feed/CatalogAtomFeed.svc/DigestedCatalogItems('Happy%20Family')</id> <title type="text"></title> <updated>2010-07-02T13:28:08Z</updated> <author> <name /> </author> <link rel="edit" title="DigestedCatalogItems" href="DigestedCatalogItems('Happy%20Family')" /> <category term="IBP.CatalogModel.DigestedCatalogItems" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> <content type="application/xml"> <m:properties> <d:Url>http://www.axa.be/ma/banbox/leaderbord_happyfamily_fr.gif</d:Url> <d:CalculatedUrl>http://www.axa.be/ma/banbox/leaderbord_happyfamily_fr.gif</d:CalculatedUrl> <d:Language>FR</d:Language> <d:Description>Happy Family</d:Description> <d:DescriptionLong>Happy Family - Banner 728x90 pixels</d:DescriptionLong> <d:CompanyCode>0039</d:CompanyCode> <d:CompanyName>AXA Belgium</d:CompanyName> <d:ProductName>Happy Family</d:ProductName> <d:ProductDomainCodeKey>X916-99</d:ProductDomainCodeKey> <d:ProductDomainCodeDescription>Multi-domein (packages)</d:ProductDomainCodeDescription> <d:TargetKey>PERSONAL</d:TargetKey> <d:CategoryKey>IBPC-02</d:CategoryKey> <d:CategoryDescription>Commerciële informatie over producten</d:CategoryDescription> <d:SubCategoryKey>IBPSC-15</d:SubCategoryKey> <d:SubCategoryDescription>Banner zonder link</d:SubCategoryDescription> <d:DisplayModeKey>FIXED_TB2_IAB</d:DisplayModeKey> <d:DisplayModeDescription>Fixed size (Telebib2 subset of IAB standard)</d:DisplayModeDescription> <d:FriendlySizeKey>IAB UAP Leaderboard (728 x 90)</d:FriendlySizeKey> <d:Width m:type="Edm.Int32">728</d:Width> <d:Height m:type="Edm.Int32">90</d:Height> <d:ProductValidity>Active</d:ProductValidity> <d:ProductVisibleFrom m:type="Edm.DateTime" m:null="true" /> <d:ProductVisibleUntil m:type="Edm.DateTime" m:null="true" /> <d:ItemValidity>NoLimit</d:ItemValidity> <d:ItemVisibleFrom m:type="Edm.DateTime" m:null="true" /> <d:ItemVisibleUntil m:type="Edm.DateTime" m:null="true" /> <d:BrokerComments m:null="true" /> <d:CatalogItemGuid xml:space="preserve">4CF21D07-365C-4580-9BCF-D87401858A2A </d:CatalogItemGuid> <d:ProductGuid xml:space="preserve">04C493FA-DE83-4CE2-A919-E19B3703DAA2 </d:ProductGuid> <d:CatalogGuid xml:space="preserve">B07EA7B4-1CB8-44E6-8C5B-181F3C2879C6 </d:CatalogGuid> <d:SecureGuid xml:space="preserve">4F952499-E8BB-4C07-AE2E-76E398D7D8EF </d:SecureGuid> </m:properties> </content> </entry> <entry> <id>http://cat.internetbrokerproject.be/IBPCatalog.V4/Feed/CatalogAtomFeed.svc/DigestedCatalogItems('Familis%20(FR)')</id> <title type="text"></title> <updated>2010-07-02T13:28:08Z</updated> <author> <name /> </author> <link rel="edit" title="DigestedCatalogItems" href="DigestedCatalogItems('Familis%20(FR)')" /> <category term="IBP.CatalogModel.DigestedCatalogItems" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> <content type="application/xml"> <m:properties> <d:Url>http://www.portalpack.aginsurance.be/sites/ibp/SiteCollectionImages/Familis/familis-offre-728x90_f.jpg</d:Url> <d:CalculatedUrl>http://www.portalpack.aginsurance.be/sites/ibp/SiteCollectionImages/Familis/familis-offre-728x90_f.jpg</d:CalculatedUrl> <d:Language>FR</d:Language> <d:Description>Banner 728x90_f Familis</d:Description> <d:DescriptionLong m:null="true" /> <d:CompanyCode>0079</d:CompanyCode> <d:CompanyName>AG Insurance</d:CompanyName> <d:ProductName>Familis (FR)</d:ProductName> <d:ProductDomainCodeKey>X916-99</d:ProductDomainCodeKey> <d:ProductDomainCodeDescription>Multi-domein (packages)</d:ProductDomainCodeDescription> <d:TargetKey>PERSONAL</d:TargetKey> <d:CategoryKey>IBPC-02</d:CategoryKey> <d:CategoryDescription>Commerciële informatie over producten</d:CategoryDescription> <d:SubCategoryKey>IBPSC-15</d:SubCategoryKey> <d:SubCategoryDescription>Banner zonder link</d:SubCategoryDescription> <d:DisplayModeKey>FIXED_TB2_IAB</d:DisplayModeKey> <d:DisplayModeDescription>Fixed size (Telebib2 subset of IAB standard)</d:DisplayModeDescription> <d:FriendlySizeKey>IAB UAP Leaderboard (728 x 90)</d:FriendlySizeKey> <d:Width m:type="Edm.Int32">728</d:Width> <d:Height m:type="Edm.Int32">90</d:Height> <d:ProductValidity>NoLimit</d:ProductValidity> <d:ProductVisibleFrom m:type="Edm.DateTime" m:null="true" /> <d:ProductVisibleUntil m:type="Edm.DateTime" m:null="true" /> <d:ItemValidity>NoLimit</d:ItemValidity> <d:ItemVisibleFrom m:type="Edm.DateTime" m:null="true" /> <d:ItemVisibleUntil m:type="Edm.DateTime" m:null="true" /> <d:BrokerComments m:null="true" /> <d:CatalogItemGuid xml:space="preserve">044BEDFB-D08E-45D6-A7AF-D482F6EF6F90 </d:CatalogItemGuid> <d:ProductGuid xml:space="preserve">BF1DBEEE-FA1C-4EEF-B007-5463EA7BC06D </d:ProductGuid> <d:CatalogGuid xml:space="preserve">DCF00761-E092-442A-9008-AFB1F9027ACE </d:CatalogGuid> <d:SecureGuid xml:space="preserve">4F952499-E8BB-4C07-AE2E-76E398D7D8EF </d:SecureGuid> </m:properties> </content> </entry> <entry> <id>http://cat.internetbrokerproject.be/IBPCatalog.V4/Feed/CatalogAtomFeed.svc/DigestedCatalogItems('Assurance%20Auto%20Top%20V%C3%A9hicule')</id> <title type="text"></title> <updated>2010-07-02T13:28:08Z</updated> <author> <name /> </author> <link rel="edit" title="DigestedCatalogItems" href="DigestedCatalogItems('Assurance%20Auto%20Top%20V%C3%A9hicule')" /> <category term="IBP.CatalogModel.DigestedCatalogItems" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> <content type="application/xml"> <m:properties> <d:Url>http://www.portalpack.aginsurance.be/sites/ibp/SiteCollectionImages/Auto/auto-top-vehicule-728x90_f.jpg</d:Url> <d:CalculatedUrl>http://www.portalpack.aginsurance.be/sites/ibp/SiteCollectionImages/Auto/auto-top-vehicule-728x90_f.jpg</d:CalculatedUrl> <d:Language>FR</d:Language> <d:Description>Banner 728x90_f Top Véhicule</d:Description> <d:DescriptionLong m:null="true" /> <d:CompanyCode>0079</d:CompanyCode> <d:CompanyName>AG Insurance</d:CompanyName> <d:ProductName>Assurance Auto Top Véhicule</d:ProductName> <d:ProductDomainCodeKey>X916-05</d:ProductDomainCodeKey> <d:ProductDomainCodeDescription>Auto</d:ProductDomainCodeDescription> <d:TargetKey>PERSONAL</d:TargetKey> <d:CategoryKey>IBPC-02</d:CategoryKey> <d:CategoryDescription>Commerciële informatie over producten</d:CategoryDescription> <d:SubCategoryKey>IBPSC-15</d:SubCategoryKey> <d:SubCategoryDescription>Banner zonder link</d:SubCategoryDescription> <d:DisplayModeKey>FIXED_TB2_IAB</d:DisplayModeKey> <d:DisplayModeDescription>Fixed size (Telebib2 subset of IAB standard)</d:DisplayModeDescription> <d:FriendlySizeKey>IAB UAP Leaderboard (728 x 90)</d:FriendlySizeKey> <d:Width m:type="Edm.Int32">728</d:Width> <d:Height m:type="Edm.Int32">90</d:Height> <d:ProductValidity>NoLimit</d:ProductValidity> <d:ProductVisibleFrom m:type="Edm.DateTime" m:null="true" /> <d:ProductVisibleUntil m:type="Edm.DateTime" m:null="true" /> <d:ItemValidity>NoLimit</d:ItemValidity> <d:ItemVisibleFrom m:type="Edm.DateTime" m:null="true" /> <d:ItemVisibleUntil m:type="Edm.DateTime" m:null="true" /> <d:BrokerComments m:null="true" /> <d:CatalogItemGuid xml:space="preserve">398768EA-9409-49C7-A822-0294202B7947 </d:CatalogItemGuid> <d:ProductGuid xml:space="preserve">C1D39F62-C674-4C41-A849-73E95CFC0789 </d:ProductGuid> <d:CatalogGuid xml:space="preserve">DCF00761-E092-442A-9008-AFB1F9027ACE </d:CatalogGuid> <d:SecureGuid xml:space="preserve">4F952499-E8BB-4C07-AE2E-76E398D7D8EF </d:SecureGuid> </m:properties> </content> </entry> <entry> <id>http://cat.internetbrokerproject.be/IBPCatalog.V4/Feed/CatalogAtomFeed.svc/DigestedCatalogItems('Assurance%20Gens%20de%20Maison')</id> <title type="text"></title> <updated>2010-07-02T13:28:08Z</updated> <author> <name /> </author> <link rel="edit" title="DigestedCatalogItems" href="DigestedCatalogItems('Assurance%20Gens%20de%20Maison')" /> <category term="IBP.CatalogModel.DigestedCatalogItems" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> <content type="application/xml"> <m:properties> <d:Url>http://www.portalpack.aginsurance.be/sites/ibp/SiteCollectionImages/Familiale/familiale-gens-maison-728x90_f.jpg</d:Url> <d:CalculatedUrl>http://www.portalpack.aginsurance.be/sites/ibp/SiteCollectionImages/Familiale/familiale-gens-maison-728x90_f.jpg</d:CalculatedUrl> <d:Language>FR</d:Language> <d:Description>Banner 728x90_f Assurance Gens de Maison</d:Description> <d:DescriptionLong m:null="true" /> <d:CompanyCode>0079</d:CompanyCode> <d:CompanyName>AG Insurance</d:CompanyName> <d:ProductName>Assurance Gens de Maison</d:ProductName> <d:ProductDomainCodeKey>X916-04</d:ProductDomainCodeKey> <d:ProductDomainCodeDescription>BA particulieren</d:ProductDomainCodeDescription> <d:TargetKey>PERSONAL</d:TargetKey> <d:CategoryKey>IBPC-02</d:CategoryKey> <d:CategoryDescription>Commerciële informatie over producten</d:CategoryDescription> <d:SubCategoryKey>IBPSC-15</d:SubCategoryKey> <d:SubCategoryDescription>Banner zonder link</d:SubCategoryDescription> <d:DisplayModeKey>FIXED_TB2_IAB</d:DisplayModeKey> <d:DisplayModeDescription>Fixed size (Telebib2 subset of IAB standard)</d:DisplayModeDescription> <d:FriendlySizeKey>IAB UAP Leaderboard (728 x 90)</d:FriendlySizeKey> <d:Width m:type="Edm.Int32">728</d:Width> <d:Height m:type="Edm.Int32">90</d:Height> <d:ProductValidity>NoLimit</d:ProductValidity> <d:ProductVisibleFrom m:type="Edm.DateTime" m:null="true" /> <d:ProductVisibleUntil m:type="Edm.DateTime" m:null="true" /> <d:ItemValidity>NoLimit</d:ItemValidity> <d:ItemVisibleFrom m:type="Edm.DateTime" m:null="true" /> <d:ItemVisibleUntil m:type="Edm.DateTime" m:null="true" /> <d:BrokerComments m:null="true" /> <d:CatalogItemGuid xml:space="preserve">745F8FB6-1DE7-4C0C-922D-DEDEE5B3A274 </d:CatalogItemGuid> <d:ProductGuid xml:space="preserve">52660D99-0DC9-40FE-9E06-FA119BCA07C4 </d:ProductGuid> <d:CatalogGuid xml:space="preserve">DCF00761-E092-442A-9008-AFB1F9027ACE </d:CatalogGuid> <d:SecureGuid xml:space="preserve">4F952499-E8BB-4C07-AE2E-76E398D7D8EF </d:SecureGuid> </m:properties> </content> </entry> <entry> <id>http://cat.internetbrokerproject.be/IBPCatalog.V4/Feed/CatalogAtomFeed.svc/DigestedCatalogItems('Assurance%20Annulation%20Voyage%20''NoGo''')</id> <title type="text"></title> <updated>2010-07-02T13:28:08Z</updated> <author> <name /> </author> <link rel="edit" title="DigestedCatalogItems" href="DigestedCatalogItems('Assurance%20Annulation%20Voyage%20''NoGo''')" /> <category term="IBP.CatalogModel.DigestedCatalogItems" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> <content type="application/xml"> <m:properties> <d:Url>http://www.portalpack.aginsurance.be/sites/ibp/SiteCollectionImages/Familis/nogo-728x90_f.jpg</d:Url> <d:CalculatedUrl>http://www.portalpack.aginsurance.be/sites/ibp/SiteCollectionImages/Familis/nogo-728x90_f.jpg</d:CalculatedUrl> <d:Language>FR</d:Language> <d:Description>Banner 728x90_f Nogo</d:Description> <d:DescriptionLong m:null="true" /> <d:CompanyCode>0079</d:CompanyCode> <d:CompanyName>AG Insurance</d:CompanyName> <d:ProductName>Assurance Annulation Voyage 'NoGo'</d:ProductName> <d:ProductDomainCodeKey>X916-21</d:ProductDomainCodeKey> <d:ProductDomainCodeDescription>Reis</d:ProductDomainCodeDescription> <d:TargetKey>PERSONAL</d:TargetKey> <d:CategoryKey>IBPC-02</d:CategoryKey> <d:CategoryDescription>Commerciële informatie over producten</d:CategoryDescription> <d:SubCategoryKey>IBPSC-15</d:SubCategoryKey> <d:SubCategoryDescription>Banner zonder link</d:SubCategoryDescription> <d:DisplayModeKey>FIXED_TB2_IAB</d:DisplayModeKey> <d:DisplayModeDescription>Fixed size (Telebib2 subset of IAB standard)</d:DisplayModeDescription> <d:FriendlySizeKey>IAB UAP Leaderboard (728 x 90)</d:FriendlySizeKey> <d:Width m:type="Edm.Int32">728</d:Width> <d:Height m:type="Edm.Int32">90</d:Height> <d:ProductValidity>NoLimit</d:ProductValidity> <d:ProductVisibleFrom m:type="Edm.DateTime" m:null="true" /> <d:ProductVisibleUntil m:type="Edm.DateTime" m:null="true" /> <d:ItemValidity>NoLimit</d:ItemValidity> <d:ItemVisibleFrom m:type="Edm.DateTime" m:null="true" /> <d:ItemVisibleUntil m:type="Edm.DateTime" m:null="true" /> <d:BrokerComments m:null="true" /> <d:CatalogItemGuid xml:space="preserve">D2BB6079-0D4E-4CF6-A28C-8187644F6028 </d:CatalogItemGuid> <d:ProductGuid xml:space="preserve">94D81AD9-7582-4D01-BF50-B486F5BCAE22 </d:ProductGuid> <d:CatalogGuid xml:space="preserve">DCF00761-E092-442A-9008-AFB1F9027ACE </d:CatalogGuid> <d:SecureGuid xml:space="preserve">4F952499-E8BB-4C07-AE2E-76E398D7D8EF </d:SecureGuid> </m:properties> </content> </entry> </feed>
je dois le traiter pour pouvoir récupérer chaque valeur séparément de la partie "entry".

Pour le moment j'en suis la

Code : Tout sélectionner

$dom = new DomDocument; $dom->load($source); $liste = $dom->getElementsByTagName("entry"); foreach($liste as $a) { echo $a->nodeValue; }
Cela me donne les valeurs de tout ce que contient "entry"

mon problème c'est que si par exemple je voudrais récupérer ce que contien "entry"->"content"->"m:properties"->"d:Url", je n'y arrive pas.
j'ai testé ceci :

Code : Tout sélectionner

{ echo $a->content->properties->Url->nodeValue; }
Mais cela ne fonctionne pas.

Comment puis-je sortir, par exemple, l'url de chaque entry ?

A bientôt.
Cedy

Re: Demande d'aide pour traiter du xml complexe

Posté : 03 juil. 2010, 13:37
par stealth35

Re: Demande d'aide pour traiter du xml complexe

Posté : 03 juil. 2010, 15:01
par cedy
Hello.

J'avoue que le traitement xml n'est pas une chose que je fais tous les jours :)

J'ai fouillé un peut sur le net et si j'ai biens compris cela me donnerais un code comme ceci pour récupérer URL de chaque ENTRY de mon fichier xml

Code : Tout sélectionner

$doc = new DOMDocument; $doc->preserveWhiteSpace = false; $doc->load($source); $xpath = new DOMXPath($doc); $query = '//feed/entry/content/properties/Url'; $entries = $xpath->query($query); foreach ($entries as $entry) { echo $entry->nodeValue."<br>\n"; }
Ce code ne m'affiche rien.

Aurais-tu un exemple concret a me proposer ? (qui fonctionnerais avec le xml posté dans mon premier message).
Si j'ai un exemple je pourrai me débrouiller pour les autres infos a retirer.
Au final je me retrouverai avec un array de 8 entrée (il y a 8 <entry></entry> dans mon xml) et ces entrées auraient des paramètres (url, language, description, product name, ...)

Re: Demande d'aide pour traiter du xml complexe

Posté : 03 juil. 2010, 15:20
par stealth35
ta besoin d'enregistrer les namespace pour que ca marche
$doc = new DOMDocument();
$doc->load($source);
	
$xpath = new DOMXpath($doc);
$xpath->registerNamespace('atom', 'http://www.w3.org/2005/Atom');
$xpath->registerNamespace('d', 'http://schemas.microsoft.com/ado/2007/08/dataservices');
	
$query = $xpath->query('//atom:entry//d:Url');
	
foreach($query as $item)
{
    var_dump($item->nodeValue);
}

Re: Demande d'aide pour traiter du xml complexe

Posté : 03 juil. 2010, 17:30
par cedy
re :)

Bon la c nickel, cela fonctionne.
Mais je ne m'attendais pas a une structure de code comme celle la.

Je pouvais avoir le même résultat en faisant comme ceci

Code : Tout sélectionner

$dom = new DomDocument; $dom->load($source); $liste = $dom->getElementsByTagName("Url"); foreach($liste as $i) { echo $i->nodeValue."<hr>\n"; }
Le but est d'avoir le code le plus légé possible.
dans le code que tu m'as expliqué ou dans mon exemple ci dessu. je ne retire que l'Url
si je veux d'autres infos de mon <entry> je dois refaire a chaque fois la même requête, donc interroger un xml distant donc lourd et lent.

n'y aurait-il pas un code de type

Code : Tout sélectionner

load du xml intérogation du xml entry->url = bla bla bla... entry->CompanyName = bla bla bla... entry->ProductName = bla bla bla... ...
Cela permettrait de interroger qu'une seule fois le xml

ce xml peut varier et je peux très vite me retrouver avec un grand nombre de <entry> et donc l'intérogation pourrait devenir longue

Re: Demande d'aide pour traiter du xml complexe

Posté : 03 juil. 2010, 17:42
par stealth35
regarde du coté de getElementsByTagNameNS, SimpleXML est pas mal aussi ca le converti direct en object :wink:

Re: Demande d'aide pour traiter du xml complexe

Posté : 04 juil. 2010, 20:04
par cedy
Tadaaaaam :)

Merci stealth35 :)
J'ai galéré a comprendre comment fonctionnait getElementsByTagNameNS mais la j'ai compris et pondu ce code qui me permet de choper la propriétée que je veux de chaque ENTRY de mon fichier xml

Code : Tout sélectionner

$dom = new DomDocument; $dom->load($source); $content = $dom->getElementsByTagNameNS("http://schemas.microsoft.com/ado/2007/08/dataservices/metadata", '*'); $properties = $dom->getElementsByTagNameNS("http://schemas.microsoft.com/ado/2007/08/dataservices", '*'); $nombre_content = $content->length; $properties_content = $properties->length; $properties_nbr = $properties_content/$nombre_content; $nombre_content = $nombre_content-1; $k=0; for($i=0; $i<=$nombre_content; $i++){ for($j=$k; $j<=$k+($properties_nbr-1); $j++){ $item[$i][$properties->item($j)->localName] = $properties->item($j)->nodeValue; } $k = $k+$properties_nbr; } echo "<pre>"; print_r($item); echo "</pre>";
Le print_r est juste la pour vérifier que le array() est bien construit.

Re: [Résolu] Demande d'aide pour traiter du xml complexe

Posté : 04 juil. 2010, 20:43
par stealth35
utilise foreach au lieu de for ca sera plus simple pas besoin de créer d'autre variable :wink: