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

Windows Forms Discussion :

parsing XML incorecte


Sujet :

Windows Forms

  1. #1
    Nouveau Candidat au Club
    Inscrit en
    Août 2009
    Messages
    3
    Détails du profil
    Informations forums :
    Inscription : Août 2009
    Messages : 3
    Points : 1
    Points
    1
    Par défaut parsing XML incorecte
    Bonjour à tous

    Voila j'ai quelques petits soucis ( sinon je ne serais pas là ) avec le parsing d'un XML.

    Donc tout d'abord voila le fichier 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
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <stats>
      <user>
        <name>[AF>XTBA>XTC] truite19</name>
        <credit_total>179419</credit_total>
        <prod_jour>0</prod_jour>
      </user>
      <projets>
     
        <projet>
          <name>Riesel Sieve</name>
          <credit_total>179419</credit_total>
          <prod_jour>0</prod_jour>
        </projet>
        <projet>
          <name>Orbit@home</name>
          <credit_total>0</credit_total>
          <prod_jour>0</prod_jour>
        </projet>
      </projets>
    </stats>
    La liste des pojets varient en fonction de l'utilisateur, mais l'organisation ne change pas.

    Voila mon code, qui est là pour charger le XML à partir d'un serveur distant le passer et faire sortir les infos dans une fenêtre.

    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
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    using System;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;
    using System.IO;
    using System.Diagnostics;
    using Stats_xtba;
    using System.Xml;
    using System.Xml.Schema;
     
     
    namespace CustomForm
    {
    	/// <summary>Fenêtre sans bordures, pouvant être redimensionnée et déplacée</summary>
    	public class Form : System.Windows.Forms.Form
    	{
     
    		// Constantes permettant le redimensionnement de la fenêtre
    		private const int WM_NCHITTEST	= 0x84;
    		private const int HTCLIENT		= 1;
    		private const int HTLEFT		= 10;
    		private const int HTRIGHT		= 11;
    		private const int HTTOP			= 12;
    		private const int HTTOPLEFT		= 13;
    		private const int HTTOPRIGHT	= 14;
    		private const int HTBOTTOM		= 15;
    		private const int HTBOTTOMLEFT	= 16;
    		private const int HTBOTTOMRIGHT	= 17;
     
    		// Contient l'épaisseur des bordures de la fenêtre
    		private readonly int _borderWidth;
     
            // Contrôles de la fenêtre
            private CustomFormControl lblTitle;
            private TextBox textBox1;
            private Label label1;
            private Panel panel1;
            private Panel panel2;
            private PictureBox pictureBox2;
            private PictureBox pictureBox3;
            private Button button1;
            private Label label7;
            private Label label6;
            private Label label5;
            private Label label4;
            private Label label3;
            private Label label8;
            private ComboBox comboBox1;
            private Label label2;
            private Label label9;
            private Label label10;
            private Label label11;
            private Label label13;
            private Label label12;
    		private CustomFormControl cmdCloseForm;
     
    		/// <summary>Constructeur de ma fenêtre</summary>
     
            public string projetname;
    		public Form()
    		{
    			InitializeComponent();
     
    			_borderWidth = 4;
     
    			SetStyle( ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true );
     
    			UpdateFormRegion();
     
                comboBox1.Items.Add(@"Projets :");
    		}
     
            private IContainer components;
     
    		#region Code généré par le concepteur WinForm
     
    		private void InitializeComponent()
    		{
                System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form));
                this.panel1 = new System.Windows.Forms.Panel();
                this.panel2 = new System.Windows.Forms.Panel();
                this.label10 = new System.Windows.Forms.Label();
                this.label9 = new System.Windows.Forms.Label();
                this.label2 = new System.Windows.Forms.Label();
                this.comboBox1 = new System.Windows.Forms.ComboBox();
                this.label8 = new System.Windows.Forms.Label();
                this.label7 = new System.Windows.Forms.Label();
                this.label6 = new System.Windows.Forms.Label();
                this.label5 = new System.Windows.Forms.Label();
                this.label4 = new System.Windows.Forms.Label();
                this.label3 = new System.Windows.Forms.Label();
                this.button1 = new System.Windows.Forms.Button();
                this.pictureBox3 = new System.Windows.Forms.PictureBox();
                this.pictureBox2 = new System.Windows.Forms.PictureBox();
                this.label1 = new System.Windows.Forms.Label();
                this.textBox1 = new System.Windows.Forms.TextBox();
                this.label11 = new System.Windows.Forms.Label();
                this.label12 = new System.Windows.Forms.Label();
                this.label13 = new System.Windows.Forms.Label();
                this.lblTitle = new CustomForm.CustomFormControl();
                this.cmdCloseForm = new CustomForm.CustomFormControl();
                this.panel1.SuspendLayout();
                this.panel2.SuspendLayout();
                ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
                ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
                this.SuspendLayout();
                // 
                // panel1
                // 
                this.panel1.Controls.Add(this.panel2);
                this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
                this.panel1.Location = new System.Drawing.Point(0, 0);
                this.panel1.Name = "panel1";
                this.panel1.Size = new System.Drawing.Size(234, 352);
                this.panel1.TabIndex = 4;
                // 
                // panel2
                // 
                this.panel2.BackColor = System.Drawing.Color.Transparent;
                this.panel2.BackgroundImage = global::Stats_xtba.Properties.Resources.fond;
                this.panel2.Controls.Add(this.label13);
                this.panel2.Controls.Add(this.label12);
                this.panel2.Controls.Add(this.label11);
                this.panel2.Controls.Add(this.label10);
                this.panel2.Controls.Add(this.label9);
                this.panel2.Controls.Add(this.label2);
                this.panel2.Controls.Add(this.comboBox1);
                this.panel2.Controls.Add(this.label8);
                this.panel2.Controls.Add(this.label7);
                this.panel2.Controls.Add(this.label6);
                this.panel2.Controls.Add(this.label5);
                this.panel2.Controls.Add(this.label4);
                this.panel2.Controls.Add(this.label3);
                this.panel2.Controls.Add(this.button1);
                this.panel2.Controls.Add(this.pictureBox3);
                this.panel2.Controls.Add(this.pictureBox2);
                this.panel2.Controls.Add(this.lblTitle);
                this.panel2.Controls.Add(this.label1);
                this.panel2.Controls.Add(this.cmdCloseForm);
                this.panel2.Controls.Add(this.textBox1);
                this.panel2.Location = new System.Drawing.Point(0, 0);
                this.panel2.Name = "panel2";
                this.panel2.Size = new System.Drawing.Size(234, 352);
                this.panel2.TabIndex = 5;
                // 
                // label10
                // 
                this.label10.AutoSize = true;
                this.label10.Location = new System.Drawing.Point(3, 226);
                this.label10.Name = "label10";
                this.label10.Size = new System.Drawing.Size(156, 13);
                this.label10.TabIndex = 19;
                this.label10.Text = "Production du jour sur le projet :";
                // 
                // label9
                // 
                this.label9.AutoSize = true;
                this.label9.Location = new System.Drawing.Point(136, 201);
                this.label9.Name = "label9";
                this.label9.Size = new System.Drawing.Size(36, 13);
                this.label9.TabIndex = 18;
                this.label9.Text = "Points";
                // 
                // label2
                // 
                this.label2.AutoSize = true;
                this.label2.Location = new System.Drawing.Point(88, 175);
                this.label2.Name = "label2";
                this.label2.Size = new System.Drawing.Size(34, 13);
                this.label2.TabIndex = 17;
                this.label2.Text = "Projet";
                // 
                // comboBox1
                // 
                this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
                this.comboBox1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
                this.comboBox1.FormattingEnabled = true;
                this.comboBox1.Location = new System.Drawing.Point(61, 130);
                this.comboBox1.Name = "comboBox1";
                this.comboBox1.Size = new System.Drawing.Size(121, 21);
                this.comboBox1.TabIndex = 15;
                this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
                // 
                // label8
                // 
                this.label8.AutoSize = true;
                this.label8.Location = new System.Drawing.Point(7, 133);
                this.label8.Name = "label8";
                this.label8.Size = new System.Drawing.Size(45, 13);
                this.label8.TabIndex = 14;
                this.label8.Text = "Projets :";
                // 
                // label7
                // 
                this.label7.AutoSize = true;
                this.label7.ForeColor = System.Drawing.Color.Black;
                this.label7.Location = new System.Drawing.Point(108, 111);
                this.label7.Name = "label7";
                this.label7.Size = new System.Drawing.Size(0, 13);
                this.label7.TabIndex = 13;
                // 
                // label6
                // 
                this.label6.AutoSize = true;
                this.label6.ForeColor = System.Drawing.Color.Black;
                this.label6.Location = new System.Drawing.Point(72, 89);
                this.label6.Name = "label6";
                this.label6.Size = new System.Drawing.Size(0, 13);
                this.label6.TabIndex = 12;
                // 
                // label5
                // 
                this.label5.AutoSize = true;
                this.label5.ForeColor = System.Drawing.Color.Black;
                this.label5.Location = new System.Drawing.Point(3, 58);
                this.label5.Name = "label5";
                this.label5.Size = new System.Drawing.Size(0, 13);
                this.label5.TabIndex = 11;
                // 
                // label4
                // 
                this.label4.AutoSize = true;
                this.label4.Location = new System.Drawing.Point(3, 111);
                this.label4.Name = "label4";
                this.label4.Size = new System.Drawing.Size(99, 13);
                this.label4.TabIndex = 10;
                this.label4.Text = "Production du jour :";
                // 
                // label3
                // 
                this.label3.AutoSize = true;
                this.label3.Location = new System.Drawing.Point(3, 89);
                this.label3.Name = "label3";
                this.label3.Size = new System.Drawing.Size(63, 13);
                this.label3.TabIndex = 9;
                this.label3.Text = "Crédit total :";
                // 
                // button1
                // 
                this.button1.FlatAppearance.BorderColor = System.Drawing.Color.RoyalBlue;
                this.button1.FlatAppearance.BorderSize = 0;
                this.button1.FlatAppearance.MouseDownBackColor = System.Drawing.Color.DarkCyan;
                this.button1.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Cyan;
                this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
                this.button1.Image = global::Stats_xtba.Properties.Resources.go;
                this.button1.Location = new System.Drawing.Point(203, 26);
                this.button1.Name = "button1";
                this.button1.Size = new System.Drawing.Size(23, 20);
                this.button1.TabIndex = 7;
                this.button1.UseVisualStyleBackColor = true;
                this.button1.Click += new System.EventHandler(this.button1_Click);
                // 
                // pictureBox3
                // 
                this.pictureBox3.Image = global::Stats_xtba.Properties.Resources.question;
                this.pictureBox3.Location = new System.Drawing.Point(26, 30);
                this.pictureBox3.Name = "pictureBox3";
                this.pictureBox3.Size = new System.Drawing.Size(16, 16);
                this.pictureBox3.TabIndex = 6;
                this.pictureBox3.TabStop = false;
                this.pictureBox3.Click += new System.EventHandler(this.pictureBox3_Click);
                // 
                // pictureBox2
                // 
                this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image")));
                this.pictureBox2.Location = new System.Drawing.Point(4, 30);
                this.pictureBox2.Name = "pictureBox2";
                this.pictureBox2.Size = new System.Drawing.Size(16, 16);
                this.pictureBox2.TabIndex = 5;
                this.pictureBox2.TabStop = false;
                this.pictureBox2.Click += new System.EventHandler(this.pictureBox2_Click);
                // 
                // label1
                // 
                this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
                this.label1.AutoSize = true;
                this.label1.BackColor = System.Drawing.Color.Transparent;
                this.label1.ForeColor = System.Drawing.Color.Black;
                this.label1.Location = new System.Drawing.Point(48, 30);
                this.label1.Name = "label1";
                this.label1.Size = new System.Drawing.Size(49, 13);
                this.label1.TabIndex = 3;
                this.label1.Text = "Pseudo :";
                this.label1.Click += new System.EventHandler(this.label1_Click);
                // 
                // textBox1
                // 
                this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
                this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
                this.textBox1.Location = new System.Drawing.Point(101, 26);
                this.textBox1.Name = "textBox1";
                this.textBox1.Size = new System.Drawing.Size(100, 20);
                this.textBox1.TabIndex = 2;
                this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
                // 
                // label11
                // 
                this.label11.AutoSize = true;
                this.label11.Location = new System.Drawing.Point(3, 175);
                this.label11.Name = "label11";
                this.label11.Size = new System.Drawing.Size(79, 13);
                this.label11.TabIndex = 20;
                this.label11.Text = "Nom du projet :";
                // 
                // label12
                // 
                this.label12.AutoSize = true;
                this.label12.Location = new System.Drawing.Point(3, 201);
                this.label12.Name = "label12";
                this.label12.Size = new System.Drawing.Size(127, 13);
                this.label12.TabIndex = 21;
                this.label12.Text = "Crédit total pour le projet :";
                // 
                // label13
                // 
                this.label13.AutoSize = true;
                this.label13.Location = new System.Drawing.Point(165, 226);
                this.label13.Name = "label13";
                this.label13.Size = new System.Drawing.Size(36, 13);
                this.label13.TabIndex = 22;
                this.label13.Text = "Points";
                // 
                // lblTitle
                // 
                this.lblTitle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                            | System.Windows.Forms.AnchorStyles.Right)));
                this.lblTitle.BackColor = System.Drawing.Color.Transparent;
                this.lblTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.lblTitle.ForeColor = System.Drawing.SystemColors.Control;
                this.lblTitle.IsClickable = false;
                this.lblTitle.Location = new System.Drawing.Point(1, 3);
                this.lblTitle.Name = "lblTitle";
                this.lblTitle.Size = new System.Drawing.Size(208, 16);
                this.lblTitle.TabIndex = 0;
                this.lblTitle.Text = "Statistiques membre";
                this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
                this.lblTitle.MouseDown += new System.Windows.Forms.MouseEventHandler(this.FormMouseDown);
                // 
                // cmdCloseForm
                // 
                this.cmdCloseForm.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
                this.cmdCloseForm.BackColor = System.Drawing.Color.Transparent;
                this.cmdCloseForm.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.cmdCloseForm.IsClickable = true;
                this.cmdCloseForm.Location = new System.Drawing.Point(214, 3);
                this.cmdCloseForm.Name = "cmdCloseForm";
                this.cmdCloseForm.Size = new System.Drawing.Size(16, 16);
                this.cmdCloseForm.TabIndex = 0;
                this.cmdCloseForm.Text = "X";
                this.cmdCloseForm.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
                this.cmdCloseForm.Click += new System.EventHandler(this.CloseForm);
                // 
                // Form
                // 
                this.AcceptButton = this.button1;
                this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
                this.BackColor = System.Drawing.SystemColors.Control;
                this.ClientSize = new System.Drawing.Size(234, 352);
                this.Controls.Add(this.panel1);
                this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                this.MaximumSize = new System.Drawing.Size(234, 352);
                this.MinimumSize = new System.Drawing.Size(234, 352);
                this.Name = "Form";
                this.Opacity = 0.8;
                this.ShowInTaskbar = false;
                this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
                this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
                this.Load += new System.EventHandler(this.Form_Load);
                this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.FormMouseDown);
                this.panel1.ResumeLayout(false);
                this.panel2.ResumeLayout(false);
                this.panel2.PerformLayout();
                ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
                ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
                this.ResumeLayout(false);
     
    		}
     
    		protected override void Dispose( bool disposing )
    		{
    			if( disposing && components != null )
    				components.Dispose();
     
    			base.Dispose( disposing );
    		}
    		#endregion
     
    		[STAThread]
    		static void Main() 
    		{
    			Application.Run( new Form() ); 
    		}
     
    		#region Apparence de la fenêtre
     
    		protected override void OnResize( EventArgs e )
    		{
    			UpdateFormRegion();
     
    			base.OnResize( e );
    		}
     
    		private void UpdateFormRegion()
    		{
    			Region formRegion = new Region( new Rectangle( 1, 0, Width - 2, Height ) );
    			formRegion.Union( new Rectangle( 0, 1, Width, Height - 2 ) );
     
    			Region = formRegion;
    		}
     
    		protected override void OnPaint( PaintEventArgs e )
    		{
    			Rectangle formRect;
     
    			if( Width > 4 && Height > 4 )
    			{
    				formRect = new Rectangle( 2, 2, Width - 4, Height - 4 );
    				LinearGradientBrush brush = new LinearGradientBrush( formRect, SystemColors.ControlLightLight, SystemColors.Control, 45f, true );
    				e.Graphics.FillRectangle( brush, formRect );
    			}
     
    			Pen lightPen = new Pen( Color.White );
    			Pen darkPen = new Pen( Utils.GetNewColor( SystemColors.Control, -20 ) );
     
    			formRect = new Rectangle( 0, 0, Width - 1, Height - 1 );
    			e.Graphics.DrawRectangle( SystemPens.ControlDark, formRect );
    			e.Graphics.DrawLine( lightPen, 1, 1, Width - 2, 1 );
    			e.Graphics.DrawLine( lightPen, 1, 1, 1, Height - 2 );
    			e.Graphics.DrawLine( darkPen, Width - 2, 1, Width - 2, Height - 2 );
    			e.Graphics.DrawLine( darkPen, 1, Height - 2, Width - 2, Height - 2 );
     
    			base.OnPaint (e);
    		}
    		#endregion
     
    		#region Déplacement de la fenêtre
    		private void FormMouseDown( object sender, MouseEventArgs e )
    		{
    			if( e.Button == MouseButtons.Left )
    			{
    				Utils.ReleaseCapture();
     
    				Utils.SendMessage( this.Handle, Utils.WM_SYSCOMMAND, 0xF012, false );
    			}
    		}
    		#endregion
     
    		#region Redimensionnement de la fenêtre
    		protected override void WndProc( ref Message m )
    		{
    			base.WndProc( ref m );
     
    			if( m.Msg == WM_NCHITTEST && m.Result.ToInt32() == HTCLIENT )
    			{
    				Point mousePoint = PointToClient( new Point( m.LParam.ToInt32() ) );
    				int mouseX = mousePoint.X;
    				int mouseY = mousePoint.Y;
     
    				if( mouseX > Width - _borderWidth )
    				{
    					if( mouseY < _borderWidth )
    					{
    						m.Result = (IntPtr)HTTOPRIGHT;
    					}
    					else if( mouseY > Height - _borderWidth )
    					{
    						m.Result = (IntPtr)HTBOTTOMRIGHT;
    					}
    					else
    					{
    						m.Result = (IntPtr)HTRIGHT;
    					}
     
    				}
    				else if( mouseX < _borderWidth )
    				{
    					if( mouseY < _borderWidth )
    					{
    						m.Result = (IntPtr)HTTOPLEFT;
    					}
    					else if( mouseY > Height - _borderWidth )
    					{
    						m.Result = (IntPtr)HTBOTTOMLEFT;
    					}
    					else
    					{
    						m.Result = (IntPtr)HTLEFT;
    					}
     
    				}
    				else if( mouseX > Width - _borderWidth )
    				{
    					if( mouseY < _borderWidth )
    					{
    						m.Result = (IntPtr)HTTOPRIGHT;
    					}
    					else if( mouseY > Height - _borderWidth )
    					{
    						m.Result = (IntPtr)HTBOTTOMRIGHT;
    					}
    					else
    					{
    						m.Result = (IntPtr)HTRIGHT;
    					}
    				}
    				else if( mouseY > Height - _borderWidth )
    				{
    					m.Result = (IntPtr)HTBOTTOM;
    				}
    				else if( mouseY < _borderWidth )
    				{
    					m.Result = (IntPtr)HTTOP;
    				}
    			}
    		}
    		#endregion
     
    		private void CloseForm( object sender, EventArgs e )
    		{
                Application.Exit();
    		}
     
            private void Form_Load(object sender, EventArgs e)
            {
     
            }
     
            private void textBox1_TextChanged(object sender, EventArgs e)
            {
     
            }
     
            private void label1_Click(object sender, EventArgs e)
            {
     
            }
     
            private void pictureBox2_Click(object sender, EventArgs e)
            {
                AboutBox1 Fen = new AboutBox1(); Fen.ShowDialog();
            }
     
            private void pictureBox3_Click(object sender, EventArgs e)
            {
                Process.Start(new ProcessStartInfo(@"http://xtbastats.homeip.net"));
            }
     
            public void button1_Click(object sender, EventArgs e)
            {
     
                ///<summary>
                ///Parsage des données du serveur d'Ivan dans des variables C# pour les réutiliser dans mon appli
                ///</summary>
                XmlNodeList projets1;
                XmlNodeList nameprojets;
                XmlNodeList Creditprojet;
                XmlNodeList Prodday; 
     
     
     
                try
                {
                    XmlDocument xDoc = new XmlDocument();
                    xDoc.Load("http://xtba.itrilium.com/fonction/export_xml.php?name=" + textBox1.Text); //Localisation de mon fichier xml dynamique sur le serveur
                    ///<summary>
                    ///Assignation des variables
                    ///</summary>
                    XmlNodeList pseudo = xDoc.GetElementsByTagName("name");
                    XmlNodeList totcred = xDoc.GetElementsByTagName("credit_total");
                    XmlNodeList dayprod = xDoc.GetElementsByTagName("prod_jour");
                    projets1 = xDoc.SelectNodes("stats/projets/projet");
                    nameprojets = xDoc.SelectNodes("stats/projets/projet/name");
                    Creditprojet = xDoc.SelectNodes(" Stats/projets/projet/credit-total"); 
                    Prodday = xDoc.SelectNodes ("Stats/projets/projet/prod_jour");
     
                    label5.Text = "" + pseudo[0].InnerText + "";
                    label6.Text = "" + totcred[0].InnerText + " points";
                    label7.Text = "" + dayprod[0].InnerText + " points";
     
                    ///<summary>
                    ///Récupération de n noms de projets et placement de ces derniers dans le comboBox1
                    ///</summary>
                    foreach (XmlNode node in nameprojets)
                    {
                        comboBox1.Items.Add(node.InnerText);
                    }
     
     
                 }
                catch
                {
                    MessageBox.Show("Veuillez entrer votre pseudo dans le champ correspondant. Si cela ne fonctionne pas, c'est que le pseudo que vous utilisez n'existe pas dans l'AF.", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
     
                }
            }
     
     
            ///<summary>
            ///Affichage des informations sur le projet sélectionné dans le comboBox1
            ///</summary>
            private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
            {
     
     
                XmlDocument xDoc = new XmlDocument();
                xDoc.Load("http://xtba.itrilium.com/fonction/export_xml.php?name=" + textBox1.Text); //Localisation de mon fichier xml dynamique sur le serveur
                ///<summary>
                ///Assignation des variables
                ///</summary>
     
                XmlNodeList nameprojects = xDoc.GetElementsByTagName("name");
                XmlNodeList Credtotal = xDoc.GetElementsByTagName("Credit_total");
                XmlNodeList Prodday = xDoc.GetElementsByTagName("Prod_jour");
     
     
                foreach (XmlNode node in nameprojects)
                {
                    if (node.InnerText == "" + comboBox1.Text + "")
                    {
                        label2.Text = node.InnerText;
                        XmlNodeList nextNode = node.ChildNodes;
                        XmlNode nextNode2 = node.SelectSingleNode("prod_jour");
     
     
     
                    }
     
                }
     
     
     
            }
    Voila encore un petit aperçu de l'application :



    Donc comme vous pouvez le voir, en haut on affiche les statistiques Global, de ce coter là c'est tout bon sa marche. Après on sélectionne un projet dans la liste et on en fait sortir le nom, c'est bon sa marche, et les points de ce projet ainsi que ceux fait aujourd'hui et c'est la que sa marche plus je ne sais pas comment faire, car il me prend toujours soit le premier node soit le dernier, mais j'ai l'impression qu'il ne voit pas ce qu'il y a entre les deux.

    Pour information j'ai supprimé par mégarde la parti du code qui me permettait d'afficher sa, mais de toute façon sa marchais pas.

    Je vous remercie par avance de votre aide

  2. #2
    Membre expérimenté
    Homme Profil pro
    Inscrit en
    Juillet 2007
    Messages
    1 277
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Réunion

    Informations forums :
    Inscription : Juillet 2007
    Messages : 1 277
    Points : 1 521
    Points
    1 521
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    <name>[AF>XTBA>XTC] truite19</name>
    Le problème vient de > dans AF>XTBA>XTC. C'est le caractère de fermeture de balise XML. Il y a deux solutions : transcoder le caractère (&gt;) ou utiliser un CDATA.

    Si le XML est fourni par un autre programme que le tiens, il est bugué.

  3. #3
    Nouveau Candidat au Club
    Inscrit en
    Août 2009
    Messages
    3
    Détails du profil
    Informations forums :
    Inscription : Août 2009
    Messages : 3
    Points : 1
    Points
    1
    Par défaut
    Je te remercie pour ta réponse, mais je me permet de te poser un question , car le pseudo ne pose pas de soucis j'arrive à le réafficher sans soucis dans l'application, alors comme pourrait il " bloquer " la lecture des donnée dans les balise projets ?

  4. #4
    Expert éminent
    Avatar de StormimOn
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mai 2005
    Messages
    2 593
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : France, Sarthe (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2005
    Messages : 2 593
    Points : 7 660
    Points
    7 660
    Par défaut
    Citation Envoyé par Kaidan
    Le problème vient de > dans AF>XTBA>XTC. C'est le caractère de fermeture de balise XML.
    C'est géré lors du chargement avec un XmlDocument, les > sont automatiquement convertis en &gt; Mais cela fonctionne dans ce cas particulier seulement parce qu'il n'y a pas de <. Par exemple avec AF<XTBA>XTC on aurait une erreur car <XTBA> serait considéré comme une balise. AF>XTBA<XTC ne passerait pas non plus. Donc il faudra revoir cette partie avec un HtmlEncode pour éviter des problèmes plus tard comme l'a relevé Kaidan.

    Sinon plutôt que devoir relire ton XML à chaque sélection tu devrais passer par le DataBinding.

    Tu réalises une classe Projet et tu alimentes une liste d'objets de type Projet qui servira de DataSource à la ComboBox via un BindingSource typé (menu Données > Ajouter une nouvelle source de données ... > Objet > sélectionner la classe Projet et pour finir déposer la source de données sur la form pour générer le BindingSource). Cela permettra de binder d'autres contrôles sur l'objet sélectionné (comme des labels).

    Si le XML n'est pas figé regarde plutôt du côté de la sérialisation. Cela simplifiera la lecture / écriture du XML. Et lors de ces opérations les caractères particuliers (comme les > et < dans le pseudo) seront gérés automatiquement. Pour le DataBinding c'est pareil après.

  5. #5
    Nouveau Candidat au Club
    Inscrit en
    Août 2009
    Messages
    3
    Détails du profil
    Informations forums :
    Inscription : Août 2009
    Messages : 3
    Points : 1
    Points
    1
    Par défaut
    je te remercie, je vais essayer de chercher un tuto ou autre car je débute quand même en C# et je ne connais pas trop ce langage.
    Ce n'est pas moi qui ai commencé le programme mais je dois le finir, lourde tache

    Mais avec votre aide je pense y arriver

Discussions similaires

  1. Choix de parsing XML
    Par soeursourire dans le forum XML/XSL et SOAP
    Réponses: 2
    Dernier message: 16/02/2006, 09h38
  2. [XML] [EXPAT] Parsing XML et tableau global
    Par GLDavid dans le forum Bibliothèques et frameworks
    Réponses: 1
    Dernier message: 10/02/2006, 12h31
  3. [DOM] Probleme de parsing Xml en java
    Par bolivari dans le forum Format d'échange (XML, JSON...)
    Réponses: 4
    Dernier message: 25/01/2006, 19h42
  4. parsing xml en francais
    Par ouioui2000 dans le forum XML/XSL et SOAP
    Réponses: 2
    Dernier message: 27/10/2005, 17h03
  5. [JSP] Parsing XML avec JDOM
    Par benben13 dans le forum Servlets/JSP
    Réponses: 9
    Dernier message: 26/08/2005, 17h19

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