Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Fast XML reader?

Subject: Fast XML reader?

From: Steven Huff

Date: 10 Jun, 2010 18:41:07

Message: 1 of 4

I have some very large XML files, up to 10mB each, that I need to read into Matlab structures. I have tried the native xmlread and several other XML readers / parsers posted on Matlab Central's File Exchange. They all work OK but have yet to find a function that can do it without taking minutes per file. Anyone run across a fast(er) XML reader function?

Subject: Fast XML reader?

From: Scott

Date: 18 Oct, 2010 17:16:05

Message: 2 of 4

I have some large XML files which are 15MB or more... in this case I get an error:
java.lang.OutOfMemoryError: Java heap space

So I am also in need of a better XML reader/parser. Particularly one that is more memory efficient. Is there something in the java libraries that I can use?

Subject: Fast XML reader?

From: tristram.scott@ntlworld.com (Tristram Scott)

Date: 19 Oct, 2010 10:05:09

Message: 3 of 4

Scott <cogan@ge.com> wrote:
>
> So I am also in need of a better XML reader/parser. Particularly one
> that is more memory efficient. Is there something in the java libraries
> that I can use?

If you are after speed and memory efficiency, rather than flexibility,
perhaps you should strip the XML tags from the file using sed / awk / perl,
to end up with a simple text file.

What does you XML file look like?

--
Dr Tristram J. Scott
Energy Consultant

Subject: Fast XML reader?

From: Chris Hulbert

Date: 19 Oct, 2010 11:10:50

Message: 4 of 4

On Oct 18, 1:16 pm, "Scott " <co...@ge.com> wrote:
> I have some large XML files which are 15MB or more... in this case I get an error:
> java.lang.OutOfMemoryError: Java heap space
>
> So I am also in need of a better XML reader/parser.  Particularly one that is more memory efficient.  Is there something in the java libraries that I can use?

You don't say what platform you are on (I've only tried the following
under Linux). The MATLAB program looks for a java.opts in your startup
directory. You can put the -Xms and -Xmx options like below which set
the minimum java heap size and the maximum (values are in bytes).

-Xms16777216
-Xmx1073741824

Every time more java heap space is required, I believe it tries to
double the current size. You can check some of these values from
within MATLAB using:

java.lang.Runtime.getRuntime.maxMemory
java.lang.Runtime.getRuntime.totalMemory
java.lang.Runtime.getRuntime.freeMemory

Chris

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us