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=1.0 required=5.0 tests=AWL,SPF_NEUTRAL 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 1708BBB84 for ; Wed, 16 Jul 2008 11:44:26 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAP1ffUjAXQIn/2dsb2JhbACwTw X-IronPort-AV: E=Sophos;i="4.30,372,1212357600"; d="scan'208";a="15157260" Received: from concorde.inria.fr ([192.93.2.39]) by mail1-smtp-roc.national.inria.fr with ESMTP; 16 Jul 2008 11:44:25 +0200 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m6G9iOov006544 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Wed, 16 Jul 2008 11:44:25 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkQDADhgfUiCiAFmiGdsb2JhbACSPgEBAQ8gnV8 X-IronPort-AV: E=Sophos;i="4.30,372,1212357600"; d="scan'208";a="15155166" Received: from leb.cs.unibo.it ([130.136.1.102]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 16 Jul 2008 11:44:24 +0200 Received: from [130.136.5.135] (faust.cs.unibo.it [130.136.5.135]) (using SSLv3 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by leb.cs.unibo.it (Postfix) with ESMTP id 25E5617EC4; Wed, 16 Jul 2008 11:44:19 +0200 (CEST) Subject: Re: [Caml-list] Q: type conversion with Gdome From: Claudio Sacerdoti Coen To: Yang Shouxun Cc: caml-list@inria.fr In-Reply-To: <200807161713.23716.yang.shx@fltrp.com> References: <200807161713.23716.yang.shx@fltrp.com> Content-Type: text/plain Organization: Department of Computer Science, University of Bologna Date: Wed, 16 Jul 2008 11:44:18 +0200 Message-Id: <1216201458.6912.81.camel@faust.cs.unibo.it> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 487DC2F8.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; gdome:01 sacerdoti:01 coen:01 sacerdot:01 unibo:01 node:01 node:01 gdome:01 cheers:01 shouxun:01 nodelist:01 nodelist:01 shouxun:01 beginner's:01 ocaml:01 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 ... 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 > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > -- ---------------------------------------------------------------- Real name: Claudio Sacerdoti Coen Doctor in Computer Science, University of Bologna E-mail: sacerdot@cs.unibo.it http://www.cs.unibo.it/~sacerdot ----------------------------------------------------------------