Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 808067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:30:17+00:00 2026-05-15T00:30:17+00:00

What path would you took to parse a large XML file (2MB – 20

  • 0

What path would you took to parse a large XML file (2MB – 20 MB or more), that does not have a schema (I cannot infer one with XSD.exe because the file structure is odd, check the snippet below)?

Options

1) XML Deserialization (but as said, I don’t have a schema and XSD tool complains about the file contents),
2) Linq to XML,
3) loading into XmlDocument,
4) Manual parsing with XmlReader & stuff.

This is XML file snippet:

<?xml version="1.0" encoding="utf-8"?>
<xmlData date="29.04.2010 12:09:13">
 <Table>
  <ident>079186</ident>
  <stock>0</stock>
  <pricewotax>33.94000000</pricewotax>
  <discountpercent>0.00000000</discountpercent>
 </Table>
 <Table>
  <ident>079190</ident>
  <stock>1</stock>
  <pricewotax>10.50000000</pricewotax>
  <discountpercent>0.00000000</discountpercent>
  <pricebyquantity>
   <Table>
    <quantity>5</quantity>
    <pricewotax>10.00000000</pricewotax>
    <discountpercent>0.00000000</discountpercent>
   </Table>
   <Table>
    <quantity>8</quantity>
    <pricewotax>9.00000000</pricewotax>
    <discountpercent>0.00000000</discountpercent>
   </Table>
  </pricebyquantity>
 </Table>
</xmlData>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T00:30:18+00:00Added an answer on May 15, 2026 at 12:30 am

    Here’s the XSD:

    <?xml version="1.0" encoding="utf-8"?>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="xmlData">
        <xs:complexType>
          <xs:sequence>
            <xs:element maxOccurs="unbounded" name="Table">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="ident" type="xs:int" />
                  <xs:element name="stock" type="xs:int" />
                  <xs:element name="pricewotax" type="xs:double" />
                  <xs:element name="discountpercent" type="xs:double" />
                  <xs:element minOccurs="0" name="pricebyquantity">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element maxOccurs="unbounded" name="Table">
                          <xs:complexType>
                            <xs:sequence>
                              <xs:element name="quantity" type="xs:int" />
                              <xs:element name="pricewotax" type="xs:double" />
                              <xs:element name="discountpercent" type="xs:double" />
                            </xs:sequence>
                          </xs:complexType>
                        </xs:element>
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="date" type="xs:string" use="required" />
        </xs:complexType>
      </xs:element>
    </xs:schema>
    

    Here’s the serializable class:

    //------------------------------------------------------------------------------
    // <auto-generated>
    //     This code was generated by a tool.
    //     Runtime Version:2.0.50727.3603
    //
    //     Changes to this file may cause incorrect behavior and will be lost if
    //     the code is regenerated.
    // </auto-generated>
    //------------------------------------------------------------------------------
    
    // 
    // This source code was auto-generated by xsd, Version=2.0.50727.1432.
    // 
    namespace StockInfo {
        using System.Xml.Serialization;
    
    
        /// <remarks/>
        [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.1432")]
        [System.SerializableAttribute()]
        [System.Diagnostics.DebuggerStepThroughAttribute()]
        [System.ComponentModel.DesignerCategoryAttribute("code")]
        [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
        [System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
        public partial class xmlData {
    
            private xmlDataTable[] tableField;
    
            private string dateField;
    
            /// <remarks/>
            [System.Xml.Serialization.XmlElementAttribute("Table")]
            public xmlDataTable[] Table {
                get {
                    return this.tableField;
                }
                set {
                    this.tableField = value;
                }
            }
    
            /// <remarks/>
            [System.Xml.Serialization.XmlAttributeAttribute()]
            public string date {
                get {
                    return this.dateField;
                }
                set {
                    this.dateField = value;
                }
            }
        }
    
        /// <remarks/>
        [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.1432")]
        [System.SerializableAttribute()]
        [System.Diagnostics.DebuggerStepThroughAttribute()]
        [System.ComponentModel.DesignerCategoryAttribute("code")]
        [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
        public partial class xmlDataTable {
    
            private int identField;
    
            private int stockField;
    
            private double pricewotaxField;
    
            private double discountpercentField;
    
            private xmlDataTableTable[] pricebyquantityField;
    
            /// <remarks/>
            public int ident {
                get {
                    return this.identField;
                }
                set {
                    this.identField = value;
                }
            }
    
            /// <remarks/>
            public int stock {
                get {
                    return this.stockField;
                }
                set {
                    this.stockField = value;
                }
            }
    
            /// <remarks/>
            public double pricewotax {
                get {
                    return this.pricewotaxField;
                }
                set {
                    this.pricewotaxField = value;
                }
            }
    
            /// <remarks/>
            public double discountpercent {
                get {
                    return this.discountpercentField;
                }
                set {
                    this.discountpercentField = value;
                }
            }
    
            /// <remarks/>
            [System.Xml.Serialization.XmlArrayItemAttribute("Table", IsNullable=false)]
            public xmlDataTableTable[] pricebyquantity {
                get {
                    return this.pricebyquantityField;
                }
                set {
                    this.pricebyquantityField = value;
                }
            }
        }
    
        /// <remarks/>
        [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.1432")]
        [System.SerializableAttribute()]
        [System.Diagnostics.DebuggerStepThroughAttribute()]
        [System.ComponentModel.DesignerCategoryAttribute("code")]
        [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
        public partial class xmlDataTableTable {
    
            private int quantityField;
    
            private double pricewotaxField;
    
            private double discountpercentField;
    
            /// <remarks/>
            public int quantity {
                get {
                    return this.quantityField;
                }
                set {
                    this.quantityField = value;
                }
            }
    
            /// <remarks/>
            public double pricewotax {
                get {
                    return this.pricewotaxField;
                }
                set {
                    this.pricewotaxField = value;
                }
            }
    
            /// <remarks/>
            public double discountpercent {
                get {
                    return this.discountpercentField;
                }
                set {
                    this.discountpercentField = value;
                }
            }
        }
    }
    

    One caveat: deserializing may not be the most performant way to parse a 20MB file. XmlReader is likely the fastest way to do it, but that means doing things manually.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 443k
  • Answers 443k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Your second solution seems fine, comma separated values in 1… May 15, 2026 at 6:21 pm
  • Editorial Team
    Editorial Team added an answer It's the debug option you have set: debug: true, Just… May 15, 2026 at 6:21 pm
  • Editorial Team
    Editorial Team added an answer E_UNEXPECTED is usually returned on catastrophic failures. It means "I… May 15, 2026 at 6:21 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.