×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Mar 2013
    Posts
    4

    Unhappy cast to SVGSVGElement from org.w3c.dom.Element fails

    Seriously, if I cast like this:

    (SVGSVGElement) (((SVGImage)blabla).getDocument().getDocumentElement())
    it works, but if I try

    (SVGSVGElement)doc.getElementById(some_id)
    I get cast error, but both getDocumentElement() and getElementById() returns the same type org.w3c.dom.Element, my global goal is to get the X-coordinates of some image on my svg-scene loaded from file, in order to zoom scene to make this image fit in visible area. I tried to achieve that with ((SVGSVGElement)doc.getElementById(some_id)).getBBox().getX() but you see what I got.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,692

    Re: cast to SVGSVGElement from org.w3c.dom.Element fails

    Is 'doc' coming from an SVGImage too?

  3. #3
    Registered User
    Join Date
    Mar 2013
    Posts
    4

    Re: cast to SVGSVGElement from org.w3c.dom.Element fails

    yes of course

  4. #4
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: cast to SVGSVGElement from org.w3c.dom.Element fails

    They both return org.w3c.dom.Element... but not necessarily SVGSVGElement. Check out the run-time type of the object you're getting...

    Code:
    Object o = doc.getElementById(some_id);
    System.out.println(o.getClass().getName());

Similar Threads

  1. Replies: 1
    Last Post: 2011-01-10, 21:23
  2. Descriptors cast
    By Tesctassa in forum Symbian
    Replies: 10
    Last Post: 2008-02-13, 19:58
  3. Opening connection to the secure element fails when restarting the midlet.
    By tfroidcoeur in forum Near Field Communication
    Replies: 6
    Last Post: 2007-08-24, 08:38
  4. Replies: 1
    Last Post: 2004-06-21, 04:06
  5. type cast
    By nitingaur00 in forum Symbian
    Replies: 1
    Last Post: 2002-11-10, 08:03

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×