Ok, I got it.

I've produced a full test-case, which is to big to put it in a mail. Download it at http://odm-budgetaire.org/private/debug/saxon-cast-tinyTree.zip
Included, the jars used (saxon9 & xerces)

Then, ant run

I use Java 1.6.0_21 from Sun/Oracle (It still is difficult to me to write Oracle here...), standard installation. I'm on an Ubuntu 10.04 LTS, 32bits kernel
Best regards,
Christophe

On 25/10/2010 15:48, Christophe Marchand wrote:
That's strange, Michael, because I can't reproduce it outside of my 
project. In my example, I have a SAXParserConfiguration.... while trying 
to instanciate xerces... but I have no reference to xerces anywhere...

Stay tuned, I will investigate this furthermore, and will repost on this 
later.

Thanks,
Christophe

On 25/10/2010 12:27, Michael Kay wrote:
  
I can't reproduce the failure you are seeing.

In fact, I don't get as far as you got. Your code is problematic because
when you create a source document and an XPath expression in Saxon, they
need to use the same Configuration, which won't happen if the
DocumentBuilderFactory and the XPathFactory are created independently.

The Saxon DocumentBuilderFactory in fact isn't very much use. The only
good reason for using the DOM with Saxon is for integration with
applications that already use the DOM, and in that case you really don't
want to be using Saxon to create the DOM; if you're in a position to do
this, it's much better to use Saxon's native tree models and APIs.

Perhaps you could supply a repro that I can actually run to reproduce
the effects that you are seeing. (And what release are you on?)

Michael Kay
Saxonica

On 25/10/2010 10:07, Christophe Marchand wrote:
   
    
Hi,

I process an XPath result, expecting DOM Element(s), but get
net.sf.saxon.tinytree.TinyElementImpl and can not cast. What am I missing ?

           domFactory = new net.sf.saxon.dom.DocumentBuilderFactoryImpl();
           domFactory.setNamespaceAware(true);
           xpathFactory = new net.sf.saxon.xpath.XPathFactoryImpl();
           Document dom = domFactory.newDocumentBuilder().parse(tmp);
           XPath xp = xpathFactory.newXPath();
           List<Element>   nodes = (List<Element>)xp.evaluate("/files/file",
dom, XPathConstants.NODESET);
           for(Element file: nodes) {
                   ret.setProperty(file.getAttribute("name"),
file.getAttribute("md5"));
           }

Christophe


------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps&   games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help

     
      
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps&  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help

   
    


------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help