You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by "Bishop, Michael W. CONTR J9C880" <Mi...@je.jfcom.mil> on 2006/03/13 18:36:07 UTC

String to SVGElement?

Hello,

     This question is probably mostly XML-related, but it does apply to
how I'm using Batik in a whiteboard.  I want to communicate SVGDocument
changes via XMPP and I send elements as strings:

 

<svg:rect fill-opacity="1"

               stroke="black"

               id="SVGWB-0C6554F5-1BDC-CC92-88DD-6CDA9D756999"

               transform="translate(0.0, 0.0) scale(1.0, 1.0)
rotate(0.0, 243.0, 283.0)"

               width="274"

               stroke-opacity="1"

               svgx:cx="243.0"

               svgx:sx="1.0"

               fill="gray"

               svgx:t="0.0"

               svgx:my="0.0"

               svgx:cy="283.0"

               svgx:sy="1.0"

               stroke-width="1"

               height="220"

               pointer-events="visible"

               svgx:mx="0.0"

               x="106"

               y="173"

               xmlns:svg=http://www.w3.org/2000/svg

               xmlns:svgx="http://je.jfcom.mil/svgx"/>

 

When the client receives this data, I want to "import" that string data
as a Node / SVGElement in the client document.  Is there a way to import
this data with the proper namespacing, document ownership, etc., that is
required to add the element information as a proper element?

 

Michael Bishop


Re: String to SVGElement?

Posted by th...@kodak.com.
Hi Michael,

"Bishop, Michael W. CONTR J9C880" <Mi...@je.jfcom.mil> wrote on 
03/13/2006 12:36:07 PM:

>      This question is probably mostly XML-related, but it does apply to 
how I?
> m using Batik in a whiteboard.  I want to communicate SVGDocument 
changes via 
> XMPP and I send elements as strings:

> When the client receives this data, I want to ?import? that string data 
as a 
> Node / SVGElement in the client document.  Is there a way to import this 
data 
> with the proper namespacing, document ownership, etc., that is required 
to add
> the element information as a proper element?

   You might want to look at the 'parseXML' method on the Window object.
It's a little hard to get to in Java but you could at least look at it's
implementation in: batik/bridge/ScriptingEnvironment.java.
It actually jumps through more hoops than you are likely to need.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org