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

MS SQL Server Discussion :

import des données de XML


Sujet :

MS SQL Server

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre du Club
    Inscrit en
    Avril 2007
    Messages
    71
    Détails du profil
    Informations forums :
    Inscription : Avril 2007
    Messages : 71
    Points : 46
    Points
    46
    Par défaut import des données de XML
    Bonjour J'ai un fichier XML, qui lui a un fichier Schema qui défini ces attribut
    Et j'aimerai prendre les données du fichier XML et les mettres dans une table que je cré pour le sujet.

    extraire d'un fichier XML pret pour le sujet est simple.Mais la j'ai un fichier schema.xml qui le défini.
    Je ne trouve pas comment prendre en charge cette définition.

    Voila je vous joins les fichies :

    0050401.xml

    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
    <?xml version="1.0" encoding="iso_8859-1"?>
    <day xmlns="x-schema:..\schema_ej.xml" FILE="00504001.901">
    <trs F1068="SALE" F254="2010-05-04" F253="2010-05-04" F1056="001" F1057="901" F1035="08:45:04" F1036="08:45:16"
    F1032="7148" F1764="00017041" F1185="1999" F1126="3332" F1127="Programmeur">
    <r><sub F04="1" F02="Épicerie" F03="1" F1101="1" F1007="8.60" F1006="1"/><F65>8.60</F65><F64>1</F64><key fn="10710"/><key fn="10720"/><key fn="10730"/><key fn="10746"/><key fn="10742"/><key fn="10200"/><key in="8.6" fn="801"/><key in="8.6" fn="715"/></r>
    <r><sub F04="3" F02="Laitier" F03="1" F1101="2" F1007="6.80" F1006="1"/><F65>6.80</F65><F64>1</F64><key in="6.8" fn="803"/><key in="6.8" fn="715"/></r>
    <r><sub F04="8" F02="Pharmacie" F03="1" F1101="3" F1007="6.55" F1006="1"/><F65>6.55</F65><F64>1</F64><key in="6.55" fn="808"/><key in="6.55" fn="715"/></r>
    <r><fct F1063="101" F02="Comptant" F1101="4"/><F65>25.00</F65><F64>1</F64><key fn="720"/><key in="25.00" fn="101"/></r>
    <t><tlz F1034="2" F02="VENTE TOTALE"/><F65>21.95</F65></t>
    <t><tlz F1034="3" F02="Vente nette"/><F65>21.95</F65><F64>3</F64></t>
    <t><tlz F1034="5" F02="Vente non taxable"/><F65>21.95</F65><F64>3</F64></t>
    <t><tlz F1034="7" F02="Vente escomptable"/><F65>21.95</F65><F64>3</F64></t>
    <t><tlz F1034="1201" F02="Comptant"/><F65>25.00</F65></t>
    <t><tlz F1034="3415" F02="Achats admissibles"/><F65>21.95</F65><F64>3</F64></t>
    <t><tlz F1034="29999" F02="A PAYER"/><F65>-3.05</F65></t>
    </trs>
    </day>


    et le schema.xml

    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
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    <?xml version="1.0" ?>
    <Schema xmlns="urn:schemas-microsoft-com:xml-data"
    	      xmlns:dt="urn:schemas-microsoft-com:datatypes">
     
    <AttributeType name="xmlns"/>
    <AttributeType name="FILE"/>
    <AttributeType name="F254"/>
    <AttributeType name="F253"/>
    <AttributeType name="F1067"/>
    <AttributeType name="F1068"/>
    <AttributeType name="F1032"/>
    <AttributeType name="F1763"/>
    <AttributeType name="F1764"/>
    <AttributeType name="F1056"/>
    <AttributeType name="F1057"/>
    <AttributeType name="F1135"/>
    <AttributeType name="F1136"/>
    <AttributeType name="F1035"/>
    <AttributeType name="F1036"/>
    <AttributeType name="F1148"/>
    <AttributeType name="F1149"/>
    <AttributeType name="F1150"/>
    <AttributeType name="F1155"/>
    <AttributeType name="F1151"/>
    <AttributeType name="F1159"/>
    <AttributeType name="F1520"/>
    <AttributeType name="F1185"/>
    <AttributeType name="F1126"/>
    <AttributeType name="F1127"/>
    <AttributeType name="F1642"/>
    <AttributeType name="F1643"/>
    <AttributeType name="F2703"/>
     
    <AttributeType name="F1101"/>
    <AttributeType name="F01"/>
    <AttributeType name="F1063"/>
    <AttributeType name="F1034"/>
    <AttributeType name="F04"/>
    <AttributeType name="F03"/>
    <AttributeType name="F02"/>
    <AttributeType name="F79"/>
    <AttributeType name="F80"/>
    <AttributeType name="F81"/>
    <AttributeType name="F82"/>
    <AttributeType name="F96"/>
    <AttributeType name="F97"/>
    <AttributeType name="F98"/>
    <AttributeType name="F113"/>
    <AttributeType name="F126"/>
    <AttributeType name="F178"/>
    <AttributeType name="F1007"/>
    <AttributeType name="F1006"/>
    <AttributeType name="F1072"/>
    <AttributeType name="F1079"/>
    <AttributeType name="F1742"/>
    <AttributeType name="F1691"/>
     
    <ElementType name="day" content="eltOnly">
      <attribute type="F254"/>
      <attribute type="FILE"/>
      <group minOccurs="0" maxOccurs="*"><element type="trs"/></group>
      <group minOccurs="0" maxOccurs="*"><element type="usr"/></group>
    </ElementType>
     
    <ElementType name="trs" content="eltOnly">
      <attribute type="F254"/>
      <attribute type="F253"/>
      <attribute type="F1068"/>
      <attribute type="F1032"/>
      <attribute type="F1763"/>
      <attribute type="F1764"/>
      <attribute type="F1056"/>
      <attribute type="F1057"/>
      <attribute type="F1135"/>
      <attribute type="F1136"/>
      <attribute type="F1035"/>
      <attribute type="F1036"/>
      <attribute type="F1185"/>
      <attribute type="F1126"/>
      <attribute type="F1127"/>
      <attribute type="F1148"/>
      <attribute type="F1149"/>
      <attribute type="F1150"/>
      <attribute type="F1155"/>
      <attribute type="F1151"/>     
      <attribute type="F1159"/>
      <attribute type="F1520"/>
      <attribute type="F1642"/>
      <attribute type="F1643"/>
      <attribute type="F2703"/>
      <group minOccurs="0" maxOccurs="*"><element type="r"/></group>
      <group minOccurs="0" maxOccurs="*"><element type="v"/></group>
      <group minOccurs="0" maxOccurs="*"><element type="t"/></group>
    </ElementType>
     
    <ElementType name="r" content="eltOnly">
      <group minOccurs="0" maxOccurs="1"><element type="itm"/></group>
      <group minOccurs="0" maxOccurs="1"><element type="sub"/></group>
      <group minOccurs="0" maxOccurs="1"><element type="dpt"/></group>
      <group minOccurs="0" maxOccurs="1"><element type="fct"/></group>
      <group minOccurs="0" maxOccurs="1"><element type="msg"/></group>
      <group minOccurs="0" maxOccurs="*"><element type="txt"/></group>
      <group minOccurs="0" maxOccurs="*"><element type="exc"/></group>
      <group minOccurs="0" maxOccurs="1"><element type="F65"/></group>
      <group minOccurs="0" maxOccurs="1"><element type="F64"/></group>
      <group minOccurs="0" maxOccurs="1"><element type="F67"/></group>
      <group minOccurs="0" maxOccurs="1"><element type="F1263"/></group>
      <group minOccurs="0" maxOccurs="1"><element type="F1843"/></group>
      <group minOccurs="0" maxOccurs="1"><element type="F1844"/></group>
      <group minOccurs="0" maxOccurs="*"><element type="key"/></group>
      <group minOccurs="0" maxOccurs="*"><element type="sku"/></group>
      <group minOccurs="0" maxOccurs="*"><element type="eft"/></group>
    </ElementType>
     
    <ElementType name="v" content="eltOnly">
      <group minOccurs="0" maxOccurs="1"><element type="itm"/></group>
      <group minOccurs="0" maxOccurs="1"><element type="sub"/></group>
      <group minOccurs="0" maxOccurs="1"><element type="dpt"/></group>
      <group minOccurs="0" maxOccurs="1"><element type="fct"/></group>
      <group minOccurs="0" maxOccurs="1"><element type="msg"/></group>
      <group minOccurs="0" maxOccurs="1"><element type="txt"/></group>
      <group minOccurs="0" maxOccurs="*"><element type="exc"/></group>
      <group minOccurs="0" maxOccurs="1"><element type="F65"/></group>
      <group minOccurs="0" maxOccurs="1"><element type="F64"/></group>
      <group minOccurs="0" maxOccurs="1"><element type="F67"/></group>
      <group minOccurs="0" maxOccurs="1"><element type="F1263"/></group>
      <group minOccurs="0" maxOccurs="1"><element type="F1843"/></group>
      <group minOccurs="0" maxOccurs="1"><element type="F1844"/></group>
      <group minOccurs="0" maxOccurs="*"><element type="key"/></group>
      <group minOccurs="0" maxOccurs="*"><element type="sku"/></group>
      <group minOccurs="0" maxOccurs="*"><element type="eft"/></group>
    </ElementType>
     
    <ElementType name="t" content="eltOnly">
      <group minOccurs="0" maxOccurs="1"><element type="tlz"/></group>
      <group minOccurs="0" maxOccurs="*"><element type="txt"/></group>
      <group minOccurs="0" maxOccurs="1"><element type="F65"/></group>
      <group minOccurs="0" maxOccurs="1"><element type="F64"/></group>
      <group minOccurs="0" maxOccurs="1"><element type="F67"/></group>
    </ElementType>
     
    <ElementType name="F64" dt:type="fixed.14.4"/>
    <ElementType name="F65" dt:type="fixed.14.4"/>
    <ElementType name="F67" dt:type="fixed.14.4"/>
    <ElementType name="F1263" dt:type="fixed.14.4"/>
    <ElementType name="F1843" dt:type="fixed.14.4"/>
    <ElementType name="F1844" dt:type="fixed.14.4"/>
     
    <ElementType name="itm" content="eltOnly">
      <attribute type="F01"/>
      <attribute type="F02"/>
      <attribute type="F04"/>
      <attribute type="F03"/>
      <attribute type="F79"/>
      <attribute type="F80"/>
      <attribute type="F178"/>
      <attribute type="F81"/>
      <attribute type="F96"/>
      <attribute type="F97"/>
      <attribute type="F98"/>
      <attribute type="F82"/>
      <attribute type="F113"/>
      <attribute type="F126"/>
      <attribute type="F254"/>
      <attribute type="F1072"/>  
      <attribute type="F1079"/>  
      <attribute type="F1742"/>  
      <attribute type="F1691"/>  
      <attribute type="F1151"/>
      <attribute type="F1101"/>
      <attribute type="F1007"/>
      <attribute type="F1006"/>
    </ElementType>
     
    <ElementType name="sub" content="eltOnly">
      <attribute type="F04"/>
      <attribute type="F03"/>
      <attribute type="F02"/>
      <attribute type="F79"/>
      <attribute type="F80"/>
      <attribute type="F178"/>
      <attribute type="F81"/>
      <attribute type="F96"/>
      <attribute type="F97"/>
      <attribute type="F98"/>
      <attribute type="F82"/>
      <attribute type="F113"/>
      <attribute type="F254"/>
      <attribute type="F1072"/>
      <attribute type="F1079"/>  
      <attribute type="F1742"/>  
      <attribute type="F1691"/>  
      <attribute type="F1151"/>
      <attribute type="F1101"/>
      <attribute type="F1007"/>
      <attribute type="F1006"/>
    </ElementType>
     
    <ElementType name="dpt" content="eltOnly">
      <attribute type="F03"/>
      <attribute type="F02"/>
      <attribute type="F79"/>
      <attribute type="F80"/>
      <attribute type="F178"/>
      <attribute type="F81"/>
      <attribute type="F96"/>
      <attribute type="F97"/>
      <attribute type="F98"/>
      <attribute type="F82"/>
      <attribute type="F113"/>
      <attribute type="F254"/>
      <attribute type="F1072"/>
      <attribute type="F1079"/>  
      <attribute type="F1742"/>  
      <attribute type="F1691"/>  
      <attribute type="F1151"/>
      <attribute type="F1101"/>
      <attribute type="F1007"/>
      <attribute type="F1006"/>
    </ElementType>
     
    <ElementType name="fct" content="eltOnly">
      <attribute type="F1063"/>
      <attribute type="F02"/>
      <attribute type="F01"/>
      <attribute type="F04"/>
      <attribute type="F03"/>
      <attribute type="F79"/>
      <attribute type="F80"/>
      <attribute type="F178"/>
      <attribute type="F81"/>
      <attribute type="F96"/>
      <attribute type="F97"/>
      <attribute type="F98"/>
      <attribute type="F82"/>
      <attribute type="F113"/>
      <attribute type="F126"/>
      <attribute type="F254"/>
      <attribute type="F1072"/>
      <attribute type="F1079"/>  
      <attribute type="F1742"/>  
      <attribute type="F1691"/>  
      <attribute type="F1151"/>
      <attribute type="F1101"/>
      <attribute type="F1007"/>
      <attribute type="F1006"/>
    </ElementType>
     
    <ElementType name="tlz" content="eltOnly">
      <attribute type="F1034"/>
      <attribute type="F02"/>
    </ElementType>
     
    <AttributeType name="F1511"/>
    <AttributeType name="F1512"/>
    <AttributeType name="F1513"/>
    <AttributeType name="F1514"/>
    <AttributeType name="F1515"/>
    <AttributeType name="F1516"/>
     
    <ElementType name="msg">
      <attribute type="F1516"/>
      <attribute type="F1067"/>
    </ElementType>
     
    <ElementType name="txt">
      <attribute type="F1516"/>
      <attribute type="F1067"/>
      <attribute type="F01"/>
      <attribute type="F02"/>
    </ElementType>
     
    <ElementType name="sku" content="eltOnly">
      <attribute type="F1067"/>
      <attribute type="F01"/>
    </ElementType>
     
    <ElementType name="exc" content="eltOnly">
      <attribute type="F1511"/>
      <attribute type="F1512"/>
      <attribute type="F1513"/>
      <attribute type="F1514"/>
      <attribute type="F1515"/>
    </ElementType>
     
    <AttributeType name="in"/>
    <AttributeType name="fn"/>
     
    <ElementType name="key" content="eltOnly">
      <attribute type="in"/>
      <attribute type="fn"/>
    </ElementType>
     
    <AttributeType name="now"/>
    <AttributeType name="acc"/>
    <AttributeType name="emi"/>
    <AttributeType name="exp"/>
    <AttributeType name="aut"/>
    <AttributeType name="ref"/>
    <AttributeType name="orginv"/>
    <AttributeType name="orgaut"/>
    <AttributeType name="orgref"/>
    <AttributeType name="typ"/>
    <AttributeType name="ent"/>
    <AttributeType name="rsp"/>
    <AttributeType name="name"/>
    <AttributeType name="term"/>
    <AttributeType name="bat"/>
    <AttributeType name="tcode"/>
    <AttributeType name="tmode"/>
     
    <ElementType name="eft" content="eltOnly">
      <attribute type="now"/>
      <attribute type="acc"/>
      <attribute type="emi"/>
      <attribute type="exp"/>
      <attribute type="aut"/>
      <attribute type="ref"/>
      <attribute type="orginv"/>
      <attribute type="orgaut"/>
      <attribute type="orgref"/>
      <attribute type="typ"/>
      <attribute type="ent"/>
      <attribute type="rsp"/>
      <attribute type="name"/>
      <attribute type="term"/>
      <attribute type="bat"/>
      <attribute type="tcode"/>
      <attribute type="tmode"/>
    </ElementType>
     
    <ElementType name="val1"/>
    <ElementType name="val2"/>
    <ElementType name="val3"/>
    <ElementType name="val4"/>
    <ElementType name="val5"/>
    <ElementType name="val6"/>
    <ElementType name="val7"/>
    <ElementType name="val8"/>
    <ElementType name="val9"/>
     
    <ElementType name="usr" content="eltOnly">
      <attribute type="F254"/>
      <attribute type="F253"/>
      <attribute type="F1032"/>
      <attribute type="F1068"/>
      <attribute type="F1056"/>
      <attribute type="F1057"/>
      <attribute type="F1035"/>
      <attribute type="F1036"/>
      <attribute type="F1185"/>
      <attribute type="F1126"/>
      <attribute type="F1127"/>
      <group minOccurs="0" maxOccurs="*"><element type="val1"/></group>
      <group minOccurs="0" maxOccurs="*"><element type="val2"/></group>
      <group minOccurs="0" maxOccurs="*"><element type="val3"/></group>
      <group minOccurs="0" maxOccurs="*"><element type="val4"/></group>
      <group minOccurs="0" maxOccurs="*"><element type="val5"/></group>
      <group minOccurs="0" maxOccurs="*"><element type="val6"/></group>
      <group minOccurs="0" maxOccurs="*"><element type="val7"/></group>
      <group minOccurs="0" maxOccurs="*"><element type="val8"/></group>
      <group minOccurs="0" maxOccurs="*"><element type="val9"/></group>
    </ElementType>
     
    </Schema>

    Mon fichier à impo`é est celui le premier mais il faut prendre en charge le schemapour que le script prend toujours l'architecture de ce dernier.

    Merci
    Merci.

  2. #2
    Expert éminent sénior
    Avatar de mikedavem
    Homme Profil pro
    Administrateur de base de données
    Inscrit en
    Août 2005
    Messages
    5 450
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Administrateur de base de données
    Secteur : Distribution

    Informations forums :
    Inscription : Août 2005
    Messages : 5 450
    Points : 12 891
    Points
    12 891
    Par défaut
    Bonsoir,

    Que voulez vous faire exactement ?

    Insérer votre document XML dans une colonne de votre table ou insérer les données du document XML dans les colonnes d'une table que vous avez créé ?

    ++

Discussions similaires

  1. [SQL Server 2005] Importer des données XML
    Par ni0urk dans le forum MS SQL Server
    Réponses: 8
    Dernier message: 22/05/2008, 09h06
  2. Réponses: 1
    Dernier message: 06/11/2007, 16h43
  3. importer des données XML dans une base Oracle 9
    Par lanfeustdetroll dans le forum JDBC
    Réponses: 3
    Dernier message: 19/07/2007, 00h09
  4. Importer des données XML
    Par Oberown dans le forum MS SQL Server
    Réponses: 3
    Dernier message: 26/07/2005, 12h59
  5. Réponses: 3
    Dernier message: 13/12/2004, 13h54

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