Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Performance problem when processing large attribute values

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Rusty Harold <elharo AT ibiblio.org>
  • To: XOM API for Processing XML with Java <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] Performance problem when processing large attribute values
  • Date: Thu, 31 May 2012 08:43:12 -0400

On Thu, May 31, 2012 at 8:28 AM, Peter Murray-Rust <pm286 AT cam.ac.uk> wrote:
> I am reading SVG files with XOM, some of which have very long strings (e.g.
> 4 Mb)  for attribute values. For example images (bitmaps) are encoded as
> attribute values, such as
>
>    <image x="0" y="0" transform="matrix(0.144,0,0,0.1439,251.521,271.844)"
> clip-path="url(#clipPath2)" width="1797"
>         xlink:href="data:image/png;
> base64,iVBORw0KGgoAAAANSUhEUgAABwUAAAV4CAMAAAB2DvLsAAADAFBM...
>        ...JRU5ErkJggg==" height="1400" preserveAspectRatio="none"
> stroke-width="0" xmlns:xlink="http://www.w3.org/1999/xlink"/>
>
> My code is
>
>        Document doc = new Builder().build(file);
>
> For a file with one attribute value of 3.9 Mbytes the time is 9 seconds
> while if the same string is PCDATA content the time is 0.1 seconds.
>
> Is this expected? and is there anything I can do to improve the parsing
> performance? I don't actually want the value - I simply want to read it in
> and throw it away.

Interesting. I'll have to look at that. Off the top of my head I
expect the problem is in the underlying parser. XOM just gets these
from the parser as a Java String and treats them as such. You might
try switching parsers, but that's just a guess.


--
Elliotte Rusty Harold
elharo AT ibiblio.org




Archive powered by MHonArc 2.6.24.

Top of Page