caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Yang Shouxun <yang.shx@fltrp.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Q: type conversion with Gdome
Date: Thu, 17 Jul 2008 09:42:44 +0800	[thread overview]
Message-ID: <416257921.13464@eyou.net> (raw)
Message-ID: <200807170942.45470.yang.shx@fltrp.com> (raw)
In-Reply-To: <1216201458.6912.81.camel@faust.cs.unibo.it>

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


      reply	other threads:[~2008-07-17  1:37 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 ` [Caml-list] " Claudio Sacerdoti Coen
     [not found]   ` <200807170942.45470.yang.shx@fltrp.com>
2008-07-17  1:42     ` Yang Shouxun [this message]

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=416257921.13464@eyou.net \
    --to=yang.shx@fltrp.com \
    --cc=caml-list@yquem.inria.fr \
    /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;
as well as URLs for NNTP newsgroup(s).