From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=AWL,MSGID_FROM_MTA_HEADER, RCVD_DOUBLE_IP_LOOSE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id F26EDBB84 for ; Thu, 17 Jul 2008 03:37:05 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApsEAN8+fkja9/QF/2dsb2JhbACSA55X X-IronPort-AV: E=Sophos;i="4.31,200,1215381600"; d="scan'208";a="15186845" Received: from unknown (HELO eyou.net) ([218.247.244.5]) by mail1-smtp-roc.national.inria.fr with SMTP; 17 Jul 2008 03:37:04 +0200 X-EYOU-SPAMVALUE:0 X-EYOU-DEALDRC: Received: (eyou anti_spam gateway 3.0); Thu, 17 Jul 2008 09:25:21 +0800 Message-ID: <416257921.13464@eyou.net> X-EYOUMAIL-SMTPAUTH: yang.shx@fltrp.com Received: from 218.247.244.25 by 129.0.0.2 with SMTP; Thu, 17 Jul 2008 09:25:20 +0800 From: Yang Shouxun Organization: FLTRP To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Q: type conversion with Gdome Date: Thu, 17 Jul 2008 09:42:44 +0800 User-Agent: KMail/1.9.9 References: <200807161713.23716.yang.shx@fltrp.com> <1216201458.6912.81.camel@faust.cs.unibo.it> In-Reply-To: <1216201458.6912.81.camel@faust.cs.unibo.it> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200807170942.45470.yang.shx@fltrp.com> X-Spam: no; 0.00; shouxun:01 fltrp:01 gdome:01 sacerdoti:01 coen:01 node:01 node:01 gdome:01 cheers:01 shouxun:01 nodelist:01 nodelist:01 shx:98 wrote:01 wrote:01 On Wednesday 16 July 2008 17:44:18 Claudio Sacerdoti Coen wrote: > Dear Yang, > > not every node is an element. Thus you need to use dinamic cast: > > let node = ... in > (* next line may raise GdomeInit.DOMCastException *) > let element = Gdome.element_of_node node in > ... Thank you very much. I haven't noticed element_of_node. As Gdome.element_of_node is a class and there is no equivalent function, thus my final version is like is: let element = new Gdnome.element_of_node node in > Cheers, > C.S.C. > On Wed, 2008-07-16 at 17:13 +0800, Yang Shouxun wrote: > > Hello everyone, > > > > I've been using Gdome for some time now and I always find it difficult to > > deal with the type system. Here is the issue: > > > > The document class has a > > method getElementsByTagName : > > tagname:Gdome.domString -> Gdome.nodeList > > and from a nodeList object I can only get Gdome.node objects, while we > > know they should be Gdome.element objects. > > > > My question is how to convert from Gdome.node to Gdome.element? > > > > P.S. Gdome.element can be converted to Gdome.node, but not in the other > > direction as far as I know. > > > > TIA, > > > > shouxun