From: Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
To: Yang Shouxun <yang.shx@fltrp.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Q: type conversion with Gdome
Date: Wed, 16 Jul 2008 11:44:18 +0200 [thread overview]
Message-ID: <1216201458.6912.81.camel@faust.cs.unibo.it> (raw)
In-Reply-To: <200807161713.23716.yang.shx@fltrp.com>
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
----------------------------------------------------------------
next prev parent reply other threads:[~2008-07-16 9:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200807161713.23716.yang.shx@fltrp.com>
2008-07-16 9:13 ` Yang Shouxun
2008-07-16 9:44 ` Claudio Sacerdoti Coen [this message]
[not found] ` <200807170942.45470.yang.shx@fltrp.com>
2008-07-17 1:42 ` [Caml-list] " Yang Shouxun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1216201458.6912.81.camel@faust.cs.unibo.it \
--to=sacerdot@cs.unibo.it \
--cc=caml-list@inria.fr \
--cc=yang.shx@fltrp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox