473,378 Members | 1,410 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Xerces Nodeiterator running out of memory for very small XML

I am trying to use node iterator of Xerces to traverse a DOM tree of a
fairly small XML file.
But I keep getting message saying running out of memory. Can someone take a
look at my code to
see what is wrong?
Thanks,
Jimmy

fi = new FileInputStream(f);
DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.parse(fi);

DocumentType myDoctype = document.getDoctype();
DocumentImpl myDocImpl = new DocumentImpl(myDoctype);
total = 10000;
Element e = document.getDocumentElement();
TestNodeFilter tnf = new TestNodeFilter();
NodeIterator myIterator = null;
Node nextNode = null;
NamedNodeMap nl = null;
Node temp = null;
for (int i=0;i<total;i++)
{
do{
try{
myIterator = myDocImpl.createNodeIterator( e, 1, null, true);
nextNode = myIterator.nextNode();
//System.out.println("node name is "+nextNode.getNodeName());
if (nextNode!=null){
nl = nextNode.getAttributes();
int z = nl.getLength();
for(int k=0;k<z;k++)
{
temp = nl.item(k);
//System.out.println("attribute name "+temp.getNodeName());
}
}
}catch(DOMException err){
}
}while(nextNode != null);
}


Jul 20 '05 #1
1 1535
What's with the 10,000? I've taken only a cursory look, but it appears
you are traversing the same information 10,000 times...
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Mee Yamo | last post by:
Fellas!! This is a very complicated one and it took me a few days to figure out exactly what's going on, but here's the final story: I have a production environment running on .NET with a SQL...
2
by: Sylwester Bała | last post by:
Hi, I have problem with Xerces can someone help me? I have implementation Xerces in Visual C++ 6.0. Xerces is only an interface of my application. Everything seems to be working well when I...
0
by: Francesc Guim Bernat | last post by:
Dear colleagues, i'm getting in troubles using one XML library with Visual Studio .NET and Xerces with Xalan. (Xercer 2.4 and Xalan 1.7) When i execute the code i get the next run time error: ...
0
by: Jim Phelps | last post by:
After having memory leak issues with Xerces-c 2.3.0 for Solaris 2.7 for CC 6.2 I have decided to update to at least 2.4. I have downloaded the binary tarball and have installed it on my...
1
by: Girish | last post by:
Hello.. I need to understand how parsing of a file or a stream(XML data in memory) takes place in Xerces C++. I am using SAX XMLReader and passing xml input as a file path or a MemBufInputSource...
1
by: Francesc Guim Bernat | last post by:
Dear colleagues, i'm getting in troubles using one XML library with Visual Studio .NET and Xerces with Xalan. When i execute the code i get the next run time error: "Run-Time Check Failure #2...
0
by: a.capp | last post by:
Hi I'm using Xerces C++ 2.7 and my application uses the DOM to build very large XML documents. The process is purely sequential in that I never need to reference a tag in the DOM once it has...
9
by: mstilli | last post by:
Hi, I am trying to use schema for server side validation using xerces to catch the validation errors. validating this XML: <Content4> <textarea13></textarea13>...
3
by: Dhirendra Singh | last post by:
I am new to xml parsing concept. can anyone suggest good books on Xerces C++ parsers. API documentation provided by apache is very raw and i do not find it very useful.
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.