IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

WinDev Discussion :

Génération d'un XML [WD20]


Sujet :

WinDev

  1. #1
    Membre régulier
    Profil pro
    Inscrit en
    Décembre 2008
    Messages
    176
    Détails du profil
    Informations personnelles :
    Âge : 43
    Localisation : Belgique

    Informations forums :
    Inscription : Décembre 2008
    Messages : 176
    Points : 91
    Points
    91
    Par défaut Génération d'un XML
    Bonne rencontre,

    Je galère sur une bêtise mais c’est la première fois que je fais ça avec Windev.

    Je dois faire une exportation d’un fichier client vers le programme Kluwer (app compta).

    Je dois avoir la ligne :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <ImportExpMPlus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instancel" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    Voici mon code.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    			// Création d'une variable XML
    			xmlCustomer est un xmlDocument
    			xmlUnNoeud est un xmlNoeud
     
    			xmlCustomer..Encodage = "ISO-8859-1"
     
    			xmlUnNoeud..Nom = "ImportExpMPlus"
     
    			nNamespace est un xmlNamespace
    			nNamespace..Nom = "xsi"
    			nNamespace..URI = "http://www.w3.org/2001/XMLSchema-instancel"		
    			Ajoute(xmlUnNoeud..NamespaceDéclaré, nNamespace)
     
    			nNamespace..Nom = "xsd"
    			nNamespace..URI = "http://www.w3.org/2001/XMLSchema"
    			Ajoute(xmlUnNoeud..NamespaceDéclaré, nNamespace)
     
    			Ajoute(xmlCustomer, xmlUnNoeud)
     
    			xmlUnNoeud..Nom = "Customers"
    			Ajoute(xmlCustomer.ImportExpMPlus, xmlUnNoeud)
    			nbrLigne est un entier = TABLE_Clients..Occurrence
     
    			POUR i = 1 A nbrLigne
    				// ----Création d'une nouveau Customer
    				xmlUnNoeud..Nom = "Customer"
    				Ajoute(xmlCustomer.ImportExpMPlus.Customers, xmlUnNoeud)
     
    				// Création des éléments de la facture
    				xmlCustomer.ImportExpMPlus.Customers.Customer[i].Prime = TABLE_Clients[i].COL_Prime
    				xmlCustomer.ImportExpMPlus.Customers.Customer[i].Afta = TABLE_Clients[i].COL_Alfa
    				xmlCustomer.ImportExpMPlus.Customers.Customer[i].Name = TABLE_Clients[i].COL_Name
    				xmlCustomer.ImportExpMPlus.Customers.Customer[i].Country = TABLE_Clients[i].COL_Country
    				xmlCustomer.ImportExpMPlus.Customers.Customer[i].HouseNumber = TABLE_Clients[i].COL_HouseNumber
    				xmlCustomer.ImportExpMPlus.Customers.Customer[i].Street = TABLE_Clients[i].COL_Street
    				xmlCustomer.ImportExpMPlus.Customers.Customer[i].ZipCode = TABLE_Clients[i].COL_ZipCode
    				xmlCustomer.ImportExpMPlus.Customers.Customer[i].City = TABLE_Clients[i].COL_City
    				xmlCustomer.ImportExpMPlus.Customers.Customer[i].Language = TABLE_Clients[i].COL_Language
    				xmlCustomer.ImportExpMPlus.Customers.Customer[i].CurrencyCode = TABLE_Clients[i].COL_CurrencyCode
    				xmlCustomer.ImportExpMPlus.Customers.Customer[i].VATCode = TABLE_Clients[i].COL_VATCode
    				xmlCustomer.ImportExpMPlus.Customers.Customer[i].VATStatus = TABLE_Clients[i].COL_VATStatus
    				xmlCustomer.ImportExpMPlus.Customers.Customer[i].VATNumber = TABLE_Clients[i].COL_VATNumber
    				xmlCustomer.ImportExpMPlus.Customers.Customer[i].Rappel = TABLE_Clients[i].COL_Rappel
    				xmlCustomer.ImportExpMPlus.Customers.Customer[i].Dom = TABLE_Clients[i].COL_Dom
    				xmlCustomer.ImportExpMPlus.Customers.Customer[i].AccountSale = TABLE_Clients[i].COL_AccountSale
    				xmlCustomer.ImportExpMPlus.Customers.Customer[i].IntrastatTransport = TABLE_Clients[i].COL_IntrastatTransport
    				xmlCustomer.ImportExpMPlus.Customers.Customer[i].Limit = TABLE_Clients[i].COL_Limit
    				xmlCustomer.ImportExpMPlus.ImportExpMPlus.Customers.Customer[i].Due = TABLE_Clients[i].COL_Due
    				xmlCustomer.ImportExpMPlus.Customers.Customer[i].DueDays = TABLE_Clients[i].COL_DueDays
    				xmlCustomer.ImportExpMPlus.Customers.Customer[i].Ventil = TABLE_Clients[i].COL_Ventil
    				xmlCustomer.ImportExpMPlus.Customers.Customer[i].IntrastatDelivery = TABLE_Clients[i].COL_IntrastatDelivery
    				xmlCustomer.ImportExpMPlus.Customers.Customer[i].DISCOUNTPERC = TABLE_Clients[i].COL_DISCOUNTPERC
    				xmlCustomer.ImportExpMPlus.Customers.Customer[i].DelivDate = TABLE_Clients[i].COL_DelivDate
    				xmlCustomer.ImportExpMPlus.Customers.Customer[i].Status = TABLE_Clients[i].COL_Status
     
    				JAUGE_JaugeLCD++
    			FIN
    			XMLSauve(xmlCustomer, LIB_NomRepClient + ...
    			"\xmlCustomer" + SAI_PeriodeMois + SAI_PériodeAnnee + ".xml", XMLDocumentDéfaut)
    			SI ErreurDétectée = Vrai ALORS
    				ErreurConstruit("Une erreur s'est produite pendant la sauvegarde : %1", ...
    				ErreurInfo(errComplet))
    			FIN
    			SAI_Message = "Nombre de client exporté " + JAUGE_JaugeLCD + " sur " + NbrClient
    Mon souci, j’ai les attributs sur tous les nœuds.

    J’ai en fin de fichier un nouveau nœud ImportExpMPlus et des balises customers en trop alors que mon dernier client de ma table est bien le dernier bon résultat.

    Voici le résultat épuré.

    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <ImportExpMPlus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instancel" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <Customers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instancel" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <Customer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instancel" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
          <Prime>1377</Prime>
          <Afta>NAMECLIENT</Afta>
          <Name>NAMECLIENT</Name>
          <Country>BE</Country>
          <HouseNumber>89</HouseNumber>
          <Street>Chemin du client</Street>
          <ZipCode>1000</ZipCode>
          <City>Ville du client</City>
          <Language>2</Language>
          <CurrencyCode>EUR</CurrencyCode>
          <VATCode>0</VATCode>
          <VATStatus>1</VATStatus>
          <VATNumber>VATCLIENT</VATNumber>
          <Rappel>1</Rappel>
          <Dom>0</Dom>
          <AccountSale>701000</AccountSale>
          <IntrastatTransport>0</IntrastatTransport>
          <Limit>0</Limit>
          <DueDays>0</DueDays>
          <Ventil>4</Ventil>
          <IntrastatDelivery>0</IntrastatDelivery>
          <DISCOUNTPERC>0</DISCOUNTPERC>
          <DelivDate>0</DelivDate>
          <Status>2</Status>
        </Customer>
      </Customers>
      <ImportExpMPlus>
        <Customers>
          <Customer>
            <Due>3</Due>
          </Customer>
          <Customer>
            <Due>3</Due>
          </Customer>
          <Customer>
            <Due>3</Due>
          </Customer>
          <Customer>
            <Due>3</Due>
          </Customer>
          <Customer>
            <Due>3</Due>
          </Customer>
          <Customer>
            <Due>3</Due>
          </Customer>
          <Customer>
            <Due>3</Due>
          </Customer>
        </Customers>
      </ImportExpMPlus>
    </ImportExpMPlus>

    Je m’y perds avec l’utilisation des nœuds à mon avis. Ce n’est clairement pas limpide dans mon esprit.

    Merci pour vos lumières.
    Raphaël.

  2. #2
    Membre chevronné
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2003
    Messages
    938
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Pyrénées Atlantiques (Aquitaine)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Alimentation

    Informations forums :
    Inscription : Mai 2003
    Messages : 938
    Points : 1 921
    Points
    1 921
    Par défaut
    Bonjour,

    Tu as une erreur ligne 48 de ton code, tu as mis
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    xmlCustomer.ImportExpMPlus.ImportExpMPlus.Customers.Customer[i].Due = TABLE_Clients[i].COL_Due
    et tu devrais avoir
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    xmlCustomer.ImportExpMPlus.Customers.Customer[i].Due = TABLE_Clients[i].COL_Due
    Bon dev,
    Philippe,


    N'hésitez à lever le pouce si mon aide vous a été utile.

  3. #3
    Membre régulier
    Profil pro
    Inscrit en
    Décembre 2008
    Messages
    176
    Détails du profil
    Informations personnelles :
    Âge : 43
    Localisation : Belgique

    Informations forums :
    Inscription : Décembre 2008
    Messages : 176
    Points : 91
    Points
    91
    Par défaut
    Bien vu !

    Voilà qui me résout les résultats en trop.

    Une idée pour tous les noeuds qui ont
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instancel" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    Alors que le seul qui devrait l'avoir est
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    <ImportExpMPlus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instancel" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  4. #4
    Membre chevronné
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2003
    Messages
    938
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Pyrénées Atlantiques (Aquitaine)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Alimentation

    Informations forums :
    Inscription : Mai 2003
    Messages : 938
    Points : 1 921
    Points
    1 921
    Par défaut
    Oui mettre un VariableRAZ() devant
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    xmlUnNoeud..Nom = "Customers"
    En effet ton xmlUnNoeud correspond encore à la définition précédente à laquelle tu as ajouté tes namespace.
    Philippe,


    N'hésitez à lever le pouce si mon aide vous a été utile.

  5. #5
    Membre régulier
    Profil pro
    Inscrit en
    Décembre 2008
    Messages
    176
    Détails du profil
    Informations personnelles :
    Âge : 43
    Localisation : Belgique

    Informations forums :
    Inscription : Décembre 2008
    Messages : 176
    Points : 91
    Points
    91
    Par défaut
    Ok, merci.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 5
    Dernier message: 30/01/2008, 15h47
  2. pb de génération de fichier xml
    Par peppena dans le forum Langage
    Réponses: 5
    Dernier message: 03/07/2006, 10h56
  3. [DOM] problème de génération d'un xml avec dom
    Par WalidNat dans le forum Bibliothèques et frameworks
    Réponses: 5
    Dernier message: 04/05/2006, 18h12
  4. [DOM] Génération dynamique fichier xml
    Par Fabouney dans le forum Bibliothèques et frameworks
    Réponses: 3
    Dernier message: 03/10/2005, 10h45

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo