Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1569 connectés 

  FORUM HardWare.fr
  Programmation
  XML/XSL

  Transformer mon XML avec XSLT

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Transformer mon XML avec XSLT

n°2185572
Pinjul64
Posté le 12-04-2013 à 11:38:06  profilanswer
 

Bonjour,
 
Je suis en bts iris, je suis en train de réaliser mon projet de fin d'année. Un application(en c++ avec Qt Creator) qui charge un fichier XML (qui contient tous les appels détaillées), généré par le système téléphonique, et qui exploite ce fichier: fonction de recherche, statistiques.
Mon fichier XML est importé dans une base de données Access que j'interroge avec mon application.
 
Voilà mon problème, voilà une partie de mon fichier XML brut :
 
 

Code :
  1. <?xml version="1.0"?>
  2. <CallAccountingList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="TicketCollector.xsd">
  3. <CallAccounting xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="CAPTicket_V001.001.xsd">
  4.  <OmniPCXOffice>
  5.   <SoftwareVersion>3EH30369CUAA ALZFR510/046.001</SoftwareVersion>
  6.   <CPUIPAddress>192.168.92.245</CPUIPAddress>
  7.  </OmniPCXOffice>
  8.  <Checksum>380140032</Checksum>
  9.  <TicketType>Call</TicketType>
  10.  <InitialUserType>G</InitialUserType>
  11.  <InitialUserID>9</InitialUserID>
  12.  <ChargedUserType>A</ChargedUserType>
  13.  <ChargedUserID>18</ChargedUserID>
  14.  <SubscriberName>JULIEN</SubscriberName>
  15.  <CommunicationType>IncomingTransfer</CommunicationType>
  16.  <TrunkType>N</TrunkType>
  17.  <TrunkID>002</TrunkID>
  18.  <Date>2013-04-04</Date>
  19.  <Time>10:38:00</Time>
  20.  <CallDuration>00:01:18</CallDuration>
  21.  <TaxesAmount>0</TaxesAmount>
  22.  <Service>ST</Service>
  23.  <AdditionalServices>X</AdditionalServices>
  24.  <DialledNumber>00559118410</DialledNumber>
  25.  <DiallingMode>M</DiallingMode>
  26.  <RingingDuration>00:00:04</RingingDuration>
  27.  <Cost>0.00</Cost>
  28.  <Currency>EUR</Currency>
  29. </CallAccounting>
  30. <CallAccounting xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="CAPTicket_V001.001.xsd">
  31.  <OmniPCXOffice>
  32.   <SoftwareVersion>3EH30369CUAA ALZFR510/046.001</SoftwareVersion>
  33.   <CPUIPAddress>192.168.92.245</CPUIPAddress>
  34.  </OmniPCXOffice>
  35.  <Checksum>473982685</Checksum>
  36.  <TicketType>Call</TicketType>
  37.  <InitialUserType>G</InitialUserType>
  38.  <InitialUserID>9</InitialUserID>
  39.  <ChargedUserType>A</ChargedUserType>
  40.  <ChargedUserID>18</ChargedUserID>
  41.  <SubscriberName>JULIEN</SubscriberName>
  42.  <CommunicationType>IncomingTransfer</CommunicationType>
  43.  <TrunkType>N</TrunkType>
  44.  <TrunkID>002</TrunkID>
  45.  <Date>2013-04-04</Date>
  46.  <Time>10:40:00</Time>
  47.  <CallDuration>00:01:22</CallDuration>
  48.  <TaxesAmount>0</TaxesAmount>
  49.  <Service>ST</Service>
  50.  <AdditionalServices>X</AdditionalServices>
  51.  <DialledNumber>0559594339</DialledNumber>
  52.  <DiallingMode>M</DiallingMode>
  53.  <RingingDuration>00:00:01</RingingDuration>
  54.  <Cost>0.00</Cost>
  55.  <Currency>EUR</Currency>
  56. </CallAccounting> ....
  57. </CallAccountingList>


 
Je dois le modifier pour obtenir ceci afin de l'intégrer dans ma base de donnée:
 

Code :
  1. <?xml version="1.0"?>
  2. <CallAccountingList>
  3. <CallAccounting>
  4.  <ChargedUserID>18</ChargedUserID>
  5.  <SubscriberName>JULIEN</SubscriberName>
  6.  <CommunicationType>IncomingTransfer</CommunicationType>
  7.  <Date>2013-04-04</Date>
  8.  <Time>10:38:00</Time>
  9.  <CallDuration>00:01:18</CallDuration>
  10.  <DialledNumber>00559118410</DialledNumber>
  11. </CallAccounting>
  12. <CallAccounting>
  13.  <ChargedUserID>18</ChargedUserID>
  14.  <SubscriberName>JULIEN</SubscriberName>
  15.  <CommunicationType>IncomingTransfer</CommunicationType>
  16.  <Date>2013-04-04</Date>
  17.  <Time>10:40:00</Time>
  18.  <CallDuration>00:01:22</CallDuration>
  19.  <DialledNumber>0559594339</DialledNumber>
  20. </CallAccounting>...
  21. </CallAccountingList>


 
Je ne connais pas du tout le XSLT, est que quelqu'un peut m'aider s'il vous plait ?
J'ai commencé à faire les modifs du fichier à la main, mais il y a plus de 50000 lignes.. :(

mood
Publicité
Posté le 12-04-2013 à 11:38:06  profilanswer
 

n°2185597
rufo
Pas me confondre avec Lycos!
Posté le 12-04-2013 à 13:24:43  profilanswer
 

Tu peux faire un script en php qui va prendre ton ficheir XML et appliquer la feuille XSL que tu auras codée pour faire la transfo.
 
Autre solution : un soft en GPL comme GeoKettle (c'est un ETL pour traiter des données géographique à la base) qui sait faire du XSL ;)


---------------
Astres, outil de help-desk GPL : http://sourceforge.net/projects/astres, ICARE, gestion de conf : http://sourceforge.net/projects/icare, Outil Planeta Calandreta : https://framalibre.org/content/planeta-calandreta
n°2185671
gilou
Modérateur
Modzilla
Posté le 12-04-2013 à 19:15:27  profilanswer
 

Si tu as besoin d'un processeur XSLT, Saxon est bien.
A+,


---------------
There's more than what can be linked! --    Iyashikei Anime Forever!    --  AngularJS c'est un framework d'engulé!  --

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  XML/XSL

  Transformer mon XML avec XSLT

 

Sujets relatifs
FLASH SWF - XML[Résolu] Enregistrer le contenu d'un XML dans BDD Mysql
Transformer un .bat en .exeméthode de recherche récursive d'un noeud en XML avec JDOM
Convertir un élement XML vers JSONSignature d'un fichier XML
Fusionner deux fichiers XML avec choix des attributstransformer des statistiques en des graphes
VBA et XML : mystere de la méthode textTransformer du XML en WSDL avec XSLT ?
Plus de sujets relatifs à : Transformer mon XML avec XSLT


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR