Re: [xsl] Is a Java program more likely to succeed in creating an in-memory representation of the input XML than an XSLT processor?

Subject: Re: [xsl] Is a Java program more likely to succeed in creating an in-memory representation of the input XML than an XSLT processor?
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 8 May 2024 12:00:51 -0000
> Is a Java program more likely to succeed in creating an in-memory
representation of the input document than an XSLT processor?

Why should it? Especially if the XSLT processor is itself a Java program?

Of course, if you design your own Java data structure then you have more
control over the tradeoffs. But the general-purpose tree models used
off-the-shelf in the Java world are far less space-efficient than the tree
models used internally by Saxon or Xalan. The main reason for that is that an
XSLT processor can take advantage of immutability; a structure in which nodes
can be added or deleted incrementally gives far less scope for optimized
memory allocation.

You might be interested in
https://blog.saxonica.com/mike/2012/09/comparing-dom-and-other-object-models.
html

> Is the Java program less likely to fail with an OutOfMemoryError?
>

No, the opposite is the case.

Michael Kay
Saxonica

Current Thread