Project

Profile

Help

Bug #1611

closed

Instance construction and use of a java.util.ArrayList

Added by Roger Martin over 11 years ago. Updated about 11 years ago.

Status:
Won't fix
Priority:
Low
Assignee:
-
Category:
Saxon extensions
Sprint/Milestone:
-
Start date:
2012-08-21
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

Hi,

Bringing this specific here.

I'm using saxonb9-1-0-8j with jdk1.7.0_05 on Unbuntu 12.04 (64 bit) and Windows 7 (Home Premium 64 bit)

Attempting to use a java.util.ArrayList for going to another class needing a Java array. But first:

...in namespace area...

xmlns:KabschAlignment="java:org.openscience.cdk.geometry.alignment.KabschAlignment"

             xmlns:cdkatom="java:org.openscience.cdk.Atom"

             xmlns:Point3d="java:javax.vecmath.Point3d"

             xmlns:ArrayList="java:java.util.ArrayList"

             xmlns:date="java:java.util.Date"

.......

further along

.......

<xsl:variable name="primary-atom-list" select="ArrayList:new()"/>

<xsl:for-each select="./cml:molecule/cml:molecule/cml:atomArray/*">

<xsl:value-of select="ArrayList:add($primary-atom-list, cdkatom:new(@elementType, Point3d:new(@x3, @y3, @z3)))[string(.)='never']"/>

</xsl:for-each>

xsl:comment

xsl:text size: </xsl:text>

<xsl:value-of select="ArrayList:size($primary-atom-list)"/>

</xsl:comment>

.......

the size as printed in the comment is zero. I've tried primitive content in place of the cdkatom for ArrayList and get same zero. Tried it with jdk1.6 and it is the same.

Could it be Java Generics?

with xmlns:ArrayList="java:java.util.ArrayList" this can be tried in about any xsl. Then use the add on an instance variable and check to see if the list has any elements.

Is there another way to get an array of objects put together to pass to a java based algorithm?

Actions #1

Updated by Michael Kay over 11 years ago

I'll need to look at this in detail because 9.1 is some time ago and memories are fading. However, collection classes like ArrayList are treated specially in the the Java-XPath mapping, in that a Java collection generally maps to an XPath sequence rather than being treated in the same way as any other class.

Actions #2

Updated by Roger Martin over 11 years ago

Hi Michael,

I see you working hard every where so leave this on very low priority. I'll experiment with the sequence mapping

Actions #3

Updated by Michael Kay about 11 years ago

  • Status changed from New to Won't fix

Closing this as "Won't fix" since it is believed that the problem is not present in currently-supported Saxon versions.

Please register to edit this issue

Also available in: Atom PDF