Loading ...
Sorry, an error occurred while loading the content.
 

Re: how to save dynamically created svg using java?

Expand Messages
  • Francis Hemsher
    ... Jim, you can save me a few moments in testing the above... Will the SVGDoc reflect a dynamcially updated svg source, or is it the document that was
    Message 1 of 12 , Jul 2 10:14 AM
      Jim Ley Wrote:

      > postURL("foo.asp",printNode(SVGDoc),null)
      >
      > and in foo.asp
      >
      > xml=Server.CreateObject("Msxml2.DOMDocument")
      > xml.load(Request)
      > xml.save("foo.svg")

      Jim, you can save me a few moments in testing the above...

      Will the SVGDoc reflect a dynamcially updated svg source, or is it
      the document that was initially loaded at the start of user's session?

      Thanks,
      Francis
    • jksaheta
      first of all thanks for the reply..I have the new svg formed in xml format ready to be sent to server(using PrintNode),.. but i dunno know how to go ahead with
      Message 2 of 12 , Jul 2 10:22 AM
        first of all thanks for the reply..I have the new svg formed
        in xml format ready to be sent to server(using PrintNode),.. but i
        dunno know
        how to go ahead with jsp/java on server side.Any
        code snippet would help.Also i've read abt Batick, is that needed
        in this case.?

        Thanks
        Joe.

        --- In svg-developers@yahoogroups.com, "Francis Hemsher"
        <francishemsher@c...> wrote:
        > Joe Wrote:
        > I am using JSP and servlets.Do you know how can i proceed in that
        > direction?
        > --------------------------------------------------------
        > I guess the same methods would apply:
        >
        > If you have your elements stored in an XML file, and have a
        > placeholder svg source file in an SVG viewer, which you fill with
        xml-
        > generated svg elements, you then have the basis for dynamcially
        > adding/changing/deleting those elements within the placeholder and
        > sending that information back to the server.
        >
        > At the end of a session, you interrogate the svg on the client,
        > convert the svg elements into xml, again at the client, then send
        the
        > updated xml data to the XML file at the server where it will be
        then
        > available for the next update session.
        >
        > Cheers,
        > Francis
      • Jim Ley
        Francis Hemsher wrote in message news:bdv3ub+87p5@eGroups.com... ... It ll be a serialisation of the live DOM, with all changes
        Message 3 of 12 , Jul 2 10:22 AM
          "Francis Hemsher" <francishemsher@...> wrote in message
          news:bdv3ub+87p5@......
          > Jim Ley Wrote:
          >
          > > postURL("foo.asp",printNode(SVGDoc),null)
          > >
          > > and in foo.asp
          > >
          > > xml=Server.CreateObject("Msxml2.DOMDocument")
          > > xml.load(Request)
          > > xml.save("foo.svg")
          >
          > Jim, you can save me a few moments in testing the above...
          >
          > Will the SVGDoc reflect a dynamcially updated svg source, or is it
          > the document that was initially loaded at the start of user's session?

          It'll be a serialisation of the live DOM, with all changes to it, you'll
          probably want to have a callback function as the 3rd parameter to postURL
          and check the response and everything. You may want to only post back the
          updated parts to save on bandwidth and printNode time.

          Jim.
        • jksaheta
          Jim, How do we do the same with java/jsp to accept the file contents sent thru posturl. thanks Joe ... session? ... you ll ... postURL ... back the
          Message 4 of 12 , Jul 2 10:36 AM
            Jim,

            How do we do the same with java/jsp to accept the file contents
            sent thru posturl.

            thanks
            Joe

            --- In svg-developers@yahoogroups.com, "Jim Ley" <jim@j...> wrote:
            >
            > "Francis Hemsher" <francishemsher@c...> wrote in message
            > news:bdv3ub+87p5@e...
            > > Jim Ley Wrote:
            > >
            > > > postURL("foo.asp",printNode(SVGDoc),null)
            > > >
            > > > and in foo.asp
            > > >
            > > > xml=Server.CreateObject("Msxml2.DOMDocument")
            > > > xml.load(Request)
            > > > xml.save("foo.svg")
            > >
            > > Jim, you can save me a few moments in testing the above...
            > >
            > > Will the SVGDoc reflect a dynamcially updated svg source, or is it
            > > the document that was initially loaded at the start of user's
            session?
            >
            > It'll be a serialisation of the live DOM, with all changes to it,
            you'll
            > probably want to have a callback function as the 3rd parameter to
            postURL
            > and check the response and everything. You may want to only post
            back the
            > updated parts to save on bandwidth and printNode time.
            >
            > Jim.
          • Jim Ley
            jksaheta wrote in message news:bdv56t+bq6c@eGroups.com... ... However you read an HTTP POST in JSP, something like: ServletInputStream
            Message 5 of 12 , Jul 2 11:08 AM
              "jksaheta" <jksaheta@...> wrote in message
              news:bdv56t+bq6c@......
              > Jim,
              >
              > How do we do the same with java/jsp to accept the file contents
              > sent thru posturl.

              However you read an HTTP POST in JSP, something like:

              ServletInputStream poststrm ;
              BufferedReader post;

              poststrm = request.getInputStream();
              d = new BufferedReader(poststrm);

              which will give you a BufferedReader which you can ReadLine from, and then
              write to a file.

              Jim.
            • jksaheta
              Hi Jim This returns null for readLine..I m pasting the posturl and jsp part below: Any pointers.. Thanks Joe. ... function on_click(evt) { text = printNode(
              Message 6 of 12 , Jul 2 12:13 PM
                Hi Jim

                This returns null for readLine..I'm pasting the posturl and jsp part
                below:
                Any pointers..

                Thanks
                Joe.

                -----------------------posturl part---------------------------
                function on_click(evt) {
                text = printNode( doc );
                alert(text);
                postURL
                ("http://localhost/thinkingreader/trial2server.jsp", text, cb );

                }
                ------------------------server part--------------------------------
                <%

                File newfile=new File("/new.svg");

                ServletInputStream poststrm ;
                BufferedReader post;

                StringBuffer sb = new StringBuffer();


                poststrm = request.getInputStream();
                post = new BufferedReader(new InputStreamReader(poststrm));


                String line = null;
                out.println("line defined"+post.readLine());

                // Read contents
                while ((line = post.readLine()) != null) {
                sb.append(line);
                sb.append('\n');
                }
                post.close();
                out.println("a"+sb.toString());

                %>
                -----------------------------------------------------


                --- In svg-developers@yahoogroups.com, "Jim Ley" <jim@j...> wrote:
                >
                > "jksaheta" <jksaheta@y...> wrote in message
                > news:bdv56t+bq6c@e...
                > > Jim,
                > >
                > > How do we do the same with java/jsp to accept the file contents
                > > sent thru posturl.
                >
                > However you read an HTTP POST in JSP, something like:
                >
                > ServletInputStream poststrm ;
                > BufferedReader post;
                >
                > poststrm = request.getInputStream();
                > d = new BufferedReader(poststrm);
                >
                > which will give you a BufferedReader which you can ReadLine from,
                and then
                > write to a file.
                >
                > Jim.
              Your message has been successfully submitted and would be delivered to recipients shortly.