Array Bounds Exception inside system.xml.dll. Test data is a dozen GB (available for the asking on CD). Source code follows. Call into system.xml.dll happens at the while statement..
using System
using System.Xml
using System.Collecti ons
// This program reads an ASCII file of XML elements
// The output is a list of unique NODE TYPEs
// For example, <head> produces head in the output
// There is no validation of the XML
namespace xmlReaderAp
/// <summary
/// Summary description for Class1
/// </summary
class Class
/// <summary
/// The main entry point for the application
/// </summary
[STAThread
static void Main(string[] args
int symbolNumber=0
ArrayList arrayList = new ArrayList()
XmlTextReader xmlReader = new XmlTextReader(@ "c:\1.xml")
tr
xmlReader.MoveT oContent(); // Get beyond the DTD which we don't care abou
catch (Exception e
Console.WriteLi ne("Exception: " + e.Message); // handle undefined DT
try
while (xmlReader.Read ())
symbolNumber++
if (symbolNumber % 100000 == 0
Console.WriteLi ne(symbolNumber )
switch (xmlReader.Node Type)
case XmlNodeType.Ele ment
// Console.Write(" <{0}>", xmlReader.Name)
bool bDoAdd = true
foreach (String memberofArrayLi st in arrayList
if (memberofArrayL ist.Equals(xmlR eader.Name)
bDoAdd = false
break
if (bDoAdd
arrayList.Add(x mlReader.Name)
break
case XmlNodeType.Tex t
// Console.Write(x mlReader.Value)
break
case XmlNodeType.CDA TA
// Console.Write(" <![CDATA[{0}]]>", xmlReader.Value )
break
case XmlNodeType.Pro cessingInstruct ion
// Console.Write(" <?{0} {1}?>", xmlReader.Name, xmlReader.Value )
break
case XmlNodeType.Com ment
// Console.Write(" <!--{0}-->", xmlReader.Value )
break
case XmlNodeType.Xml Declaration
// Console.Write(" <?xml version='1.0'?> ")
break
case XmlNodeType.Doc ument
break
case XmlNodeType.Doc umentType
// Console.Write(" <!DOCTYPE {0} [{1}]", xmlReader.Name, xmlReader.Value )
break
case XmlNodeType.Ent ityReference
// Console.Write(x mlReader.Name)
break
case XmlNodeType.End Element
// Console.Write(" </{0}>", xmlReader.Name)
break
xmlReader.Close ()
foreach (String memberofArrayLi st in arrayList
Console.WriteLi ne(memberofArra yList)
Console.WriteLi ne("This program has terminated.")
catch(Exception e)
xmlReader.Close ()
Console.WriteLi ne("Exception: " + e.Message)
Console.WriteLi ne(e.StackTrace )
Console.WriteLi ne(e.Source)
foreach (String memberofArrayLi st in arrayList
Console.WriteLi ne(memberofArra yList)
Console.WriteLi ne("This program has terminated.")
return 4 3849
William McIlroy wrote: Array Bounds Exception inside system.xml.dll. Test data is a dozen GB (available for the asking on CD). Source code follows. Call into system.xml.dll happens at the while statement...
Dozen GB XML document???? Holy cow! :)
Provide more info please: .NET version, exact exception message along
with full stack trace.
Should note also - the following loop:
foreach (String memberofArrayLi st in arrayList)
if (memberofArrayL ist.Equals(xmlR eader.Name))
is a way ineffective, you can get huge raise in performance using
Hashtable instead of ArrayList.
--
Oleg Tkachenko [XML MVP, XmlInsider] http://blog.tkachenko.com
Exception: Index was outside the bounds of the array
at System.Xml.XmlT extReader.SetEl ementValues(
at System.Xml.XmlT extReader.Parse Element(
at System.Xml.XmlT extReader.Read(
at xmlReaderApp.Cl ass1.Main(Strin g[] args
A first chance exception of type 'System.IndexOu tOfRangeExcepti on' occurred in system.xml.dl
Additional information: Index was outside the bounds of the array
1.1.4322 VERSION of .NE
Since I wrote the program for myself, I don't care about performance. It is fast enough for me
You heard correctly: 11 gigabytes. It is generated by a National Institutes of Health conversion program
But thanks for the advice
Originally, the structured data is in ASN.1 format.
William McIlroy wrote: Exception: Index was outside the bounds of the array. at System.Xml.XmlT extReader.SetEl ementValues() at System.Xml.XmlT extReader.Parse Element() at System.Xml.XmlT extReader.Read( ) at xmlReaderApp.Cl ass1.Main(Strin g[] args)
Apparently 2Gb is the limitation of the XmlTextReader. See http://groups.google.com/groups?hl=e...A11%26rnum%3D1
--
Oleg Tkachenko [XML MVP] http://blog.tkachenko.com
Very well. I'll write my business application in Java. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Eugene |
last post by:
Hello all,
I've been trying to figure this out for a few days now, and still have
no clue what's going on...
I have a few related tables in MS Access (Clients, Cars, Sales), and a
datagrid, binded to dataview.
Here's a catch - whenever I select a client, and then find a car which
belongs to this client, and click on empty space in datagrid (that is
in gray area below rows) - I get "Index was outside the bounds of the
array" error......
|
by: User |
last post by:
Hi,
This is very basic, It may be a repost, if so I'm sorry.
The problem is that this declaration :
Private strMyArray(100) As String
will create an array of string with a length of 101, but the length
should be only of 100 (0 to 99).
|
by: Shawn B. |
last post by:
Greets,
I am saying
int y = 0;
byte x;
x = new byte;
And this work until
|
by: Flip |
last post by:
I'm reading the O'Reilly's Progamming C# book and I have a question about
array bounds checking. On page 174, near the top, they show an example
where c# does indeed to array bounds checking cause the example shows a
System.IndexOutOfRangeException being thrown. However, in the very next
section (Jagged arrays) they have warning section that says "Java
programmers take note: While Java does bounds checking on array use, C# does
not." ...
|
by: scotthutchinson |
last post by:
I have a .NET Remoting object hosted in IIS6 on Windows Server 2003
(happens before and after installing SP1) at an endpoint (ASP.NET
application virtual folder) named "CompanyXYZReporting". The remoted
object is called several times every day and works perfectly except
every 2-3 weeks when we call the remoted object, the response returns
the error shown below. Does anyone have any clues how to resolve this
problem?
Server Error in...
| |
by: Antoine |
last post by:
I can't work out what is causing this problem. Can anyone suggest what the
typical causes beyond the obvious might be? Could you get it with datasets?
Maybe I should run in debug mode and test certain bits of code for
"erroneous" and unpredictable values?
Many thanks!
"An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the exception
can be identified...
|
by: Antoine |
last post by:
Herfried and Cor:-
I used tracing and actually tracked down the code that was causing the
problem most likely. I wonder if you wanted to comment on it.
Also I wonder if there is a better way of testing if there is data than
testing the length of the xml string I used as stringreader to create the
dataset, but thats a side issue.
I think I tried isdbnull and is nothing and stuff like that and they cause
|
by: jacob navia |
last post by:
We hear very often in this discussion group that
bounds checking, or safety tests are too expensive
to be used in C.
Several researchers of UCSD have published an interesting
paper about this problem.
http://www.jilp.org/vol9/v9paper10.pdf
Specifically, they measured the overhead of a bounds
|
by: vippstar |
last post by:
The subject might be misleading.
Regardless, is this code valid:
#include <stdio.h>
void f(double *p, size_t size) { while(size--) printf("%f\n", *p++); }
int main(void) {
double array = { { 3.14 }, { 42.6 } };
f((double *)array, sizeof array / sizeof **array);
return 0;
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |