Click here to Skip to main content
15,886,199 members
Articles / Programming Languages / XML

Large XML Files Processing and Indexing

Rate me:
Please Sign up or sign in to vote.
4.88/5 (10 votes)
14 Nov 2008CPOL3 min read 68.7K   1.4K   47  
Index large XML file for fast access. Use IO and XMLReader for parsing with Regex.
namespace FileContextIndexer {
    partial class Form1 {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing) {
            if (disposing && (components != null)) {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent() {
            this.btnIndex = new System.Windows.Forms.Button();
            this.openFileDlg = new System.Windows.Forms.OpenFileDialog();
            this.txtNode = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.btnReadIndexed = new System.Windows.Forms.Button();
            this.txtPos = new System.Windows.Forms.TextBox();
            this.tbOutput = new System.Windows.Forms.RichTextBox();
            this.label3 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.txtCondition = new System.Windows.Forms.TextBox();
            this.label4 = new System.Windows.Forms.Label();
            this.SuspendLayout();
            // 
            // btnIndex
            // 
            this.btnIndex.Location = new System.Drawing.Point(365, 6);
            this.btnIndex.Name = "btnIndex";
            this.btnIndex.Size = new System.Drawing.Size(151, 43);
            this.btnIndex.TabIndex = 0;
            this.btnIndex.Text = "Index XML File";
            this.btnIndex.UseVisualStyleBackColor = true;
            this.btnIndex.Click += new System.EventHandler(this.btnIndex_Click);
            // 
            // openFileDlg
            // 
            this.openFileDlg.FileName = global::FileContextIndexer.Properties.Settings.Default.HXML;
            this.openFileDlg.Filter = "xml|*.xml";
            this.openFileDlg.InitialDirectory = global::FileContextIndexer.Properties.Settings.Default.C;
            this.openFileDlg.Title = "Huge XML Selector";
            // 
            // txtNode
            // 
            this.txtNode.Location = new System.Drawing.Point(107, 6);
            this.txtNode.Name = "txtNode";
            this.txtNode.Size = new System.Drawing.Size(250, 20);
            this.txtNode.TabIndex = 2;
            this.txtNode.Text = "INVOICE";
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(12, 9);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(89, 13);
            this.label1.TabIndex = 3;
            this.label1.Text = "Node to Index on";
            // 
            // btnReadIndexed
            // 
            this.btnReadIndexed.Enabled = false;
            this.btnReadIndexed.Location = new System.Drawing.Point(299, 336);
            this.btnReadIndexed.Name = "btnReadIndexed";
            this.btnReadIndexed.Size = new System.Drawing.Size(215, 39);
            this.btnReadIndexed.TabIndex = 6;
            this.btnReadIndexed.Text = "Read";
            this.btnReadIndexed.UseVisualStyleBackColor = true;
            this.btnReadIndexed.Click += new System.EventHandler(this.btnReadIndexed_Click);
            // 
            // txtPos
            // 
            this.txtPos.Location = new System.Drawing.Point(11, 352);
            this.txtPos.Name = "txtPos";
            this.txtPos.Size = new System.Drawing.Size(221, 20);
            this.txtPos.TabIndex = 7;
            // 
            // tbOutput
            // 
            this.tbOutput.Location = new System.Drawing.Point(12, 68);
            this.tbOutput.Name = "tbOutput";
            this.tbOutput.Size = new System.Drawing.Size(503, 255);
            this.tbOutput.TabIndex = 8;
            this.tbOutput.Text = "";
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(12, 336);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(133, 13);
            this.label3.TabIndex = 9;
            this.label3.Text = "Position in Copied File: (int)";
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(15, 32);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(86, 13);
            this.label2.TabIndex = 10;
            this.label2.Text = "XPath Condition:";
            // 
            // txtCondition
            // 
            this.txtCondition.Location = new System.Drawing.Point(107, 29);
            this.txtCondition.Name = "txtCondition";
            this.txtCondition.Size = new System.Drawing.Size(250, 20);
            this.txtCondition.TabIndex = 11;
            this.txtCondition.Text = "//./@ID";
            // 
            // label4
            // 
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(12, 52);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(114, 13);
            this.label4.TabIndex = 12;
            this.label4.Text = "Selected Node output:";
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(526, 387);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.txtCondition);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.tbOutput);
            this.Controls.Add(this.txtPos);
            this.Controls.Add(this.btnReadIndexed);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.txtNode);
            this.Controls.Add(this.btnIndex);
            this.MaximumSize = new System.Drawing.Size(534, 421);
            this.MinimumSize = new System.Drawing.Size(534, 421);
            this.Name = "Form1";
            this.Text = "XML Content Indexer";
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Button btnIndex;
        private System.Windows.Forms.OpenFileDialog openFileDlg;
        private System.Windows.Forms.TextBox txtNode;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Button btnReadIndexed;
        private System.Windows.Forms.TextBox txtPos;
        private System.Windows.Forms.RichTextBox tbOutput;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.TextBox txtCondition;
        private System.Windows.Forms.Label label4;
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Tateeda Media Networks
United States United States

Software development is my passion as well as photography.


If you got a sec stop by to see my photography work at http://sk68.com


Tateeda Media Network

Comments and Discussions