Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6255241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:19:44+00:00 2026-05-24T14:19:44+00:00

What I want to do is to insert new Element to SVGDocument taken from

  • 0

What I want to do is to insert new Element to SVGDocument taken from JSVG canvas, so that it is should be automatically rendered and can be viewed.

So I have a JSVGCanvas, named SVGcanvas, and at LoadEventDispatcher I get the the SVGDocument, named doc, like this code:

this.SVGCanvas.addSVGLoadEventDispatcherListener(
    new SVGLoadEventDispatcherAdapter() {
        @Override
        public void svgLoadEventDispatchStarted (SVGLoadEventDispatcherEvent e) {
            doc = SVGCanvas.getSVGDocument();
            ...
        }
}

up is based on this: http://www.svgopen.org/2002/papers/kormann__developing_svg_apps_with_batik/

and then inside an event listener, I use this code

public void handleEvent (Event evt) {
    setRB(this.IDButtonGroup, this.ID);
    Element r = ((SVGDocument) doc).createElement("use");
    r.setAttribute("xhtml:href", "#cell");
    doc.getDocumentElement().appendChild(r);
}

based on this: http://wiki.apache.org/xmlgraphics-batik/DynamicSvgOffscreen

I thought it will work at onscreen, but I still can’t get it to work. Anyone can help? The setRB function is work okay, so I don’t think the problem is in the handler. I think the SVGCanvas not rendering the new doc. The doc should be SVGCanvas’s, and because I had set the Document State of SVG Canvas to be ALWAYS_DYNAMIC, I thought it will be updated automatically. Did I miss something?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T14:19:46+00:00Added an answer on May 24, 2026 at 2:19 pm

    Okay, the way I do it is right, but I do miss something.
    based on this: http://www.carto.net/papers/svg/manipulating_svg_with_dom_ecmascript/
    I should use

    public void handleEvent (Event evt) {
        setRB(this.IDButtonGroup, this.ID);
        Element r = ((SVGDocument) doc).createElementNS(SVGNS,"use");
        r.setAttributeNS(XLINKNS, "href", "#cell");
        doc.getDocumentElement().appendChild(r);
    }
    

    and you are done! The cell defs is in the SVGCanvas now!
    Oh yeah, the SVGNS and XLINKNS is NameSpace String Constant

    String svgNS = "http://www.w3.org/2000/svg";
    var xlinkNS = "http://www.w3.org/1999/xlink";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

so the problem is, that i want to insert a new row after another
I want to insert tags in new Place. giving that tags is in different
EntityManager.merge() can insert new objects and update existing ones. Why would one want to
I have an Array and want to insert a new element in between all
I want insert new a element in panel, the insert is good but hide.
I want some help for someone about how to insert a new element in
I want to insert a new row into an Access database. I'm looking at
I am using the html table. I want to insert a new row to
I want to insert row for each day to add new values, and I
I'm new to Java. I want to create Java Array and insert data into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.