problem dynamically adding svg

View: New views
7 Messages — Rating Filter:   Alert me  

problem dynamically adding svg

by david_bigd42 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Here is my problem. I have a static svg file, and at various times i
will need to add additional svg to this document. I can do this for a
small number of elements with no problem via the createElementNS,
setAttribute, and appendChild methods. But now i need to add a few
thousand elements at a time.

I use and xmlhttp (ajax) transfer to get the new svg. The server
returns valid svg, and when i try to append the xmlhttp.responseXML to
the svg document, i get a type mismatch error thrown.

Any ideas?





------------------------ Yahoo! Groups Sponsor --------------------~-->
Most low income homes are not online. Make a difference this holiday season!
http://us.click.yahoo.com/5UeCyC/BWHMAA/TtwFAA/1U_rlB/TM
--------------------------------------------------------------------~->

-----
To unsubscribe send a message to: svg-developers-unsubscribe@...
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my membership"
----
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    svg-developers-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




Re: problem dynamically adding svg

by Andreas Neumann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

in which SVG viewer/implementation?
 
ASV and Batik, e.g. don't support XMLHttpRequest. They support
getURL(). In order to support all of the viewers you must fork your
code and see which method is available. You can write a helper
object or function for this.
 
http://www.carto.net/papers/svg/resources/helper_functions.js e.g.
has a getXMLData object that you could use for that purpose.
 
In order to use it, you can write the following code:
 
var myGetXMLObj = new getXMLData(url,callBackFunction);
myGetXMLObj.getData();
 
You get back a ready to use XML node that you can either append to
the DOM (if SVG compatible) or parse per script.
 
I don't know how well it works with thousands of elements. Many of
the current SVG viewers might not be fast enough to process huge
amounts of data.
 
Andreas
 
--- In svg-developers@..., "david_bigd42" <mumrah@g...>
wrote:
>
> Here is my problem. I have a static svg file, and at various times
i
> will need to add additional svg to this document. I can do this
for a
> small number of elements with no problem via the createElementNS,
> setAttribute, and appendChild methods. But now i need to add a few
> thousand elements at a time.  
>  
> I use and xmlhttp (ajax) transfer to get the new svg. The server
> returns valid svg, and when i try to append the
xmlhttp.responseXML to
> the svg document, i get a type mismatch error thrown.  
>  
> Any ideas?
>
 






------------------------ Yahoo! Groups Sponsor --------------------~-->
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/KIlPFB/vlQLAA/TtwFAA/1U_rlB/TM
--------------------------------------------------------------------~->

-----
To unsubscribe send a message to: svg-developers-unsubscribe@...
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my membership"
----
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    svg-developers-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Re: problem dynamically adding svg

by pilatfr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> You get back a ready to use XML node that you can either append to
> the DOM (if SVG compatible) or parse per script.

I try this method to add widgets on user request .... but
* objects are not draw ...
* I cannot acceed objects to modify properties
* objects are in DOM ( DOM inspector ) but URI for namespace is empty

How give svg namespace and see this objects?

Michel

PS I know that I can load this widgets at begining and show/hide
them ... but as I have complicated widgets as filesystem or more ...
I prefer load them on request and remove them after using

--- In svg-developers@..., "Andreas Neumann"
<neumann@k...> wrote:

>
> in which SVG viewer/implementation?
>  
> ASV and Batik, e.g. don't support XMLHttpRequest. They support
> getURL(). In order to support all of the viewers you must fork your
> code and see which method is available. You can write a helper
> object or function for this.
>  
> http://www.carto.net/papers/svg/resources/helper_functions.js e.g.
> has a getXMLData object that you could use for that purpose.
>  
> In order to use it, you can write the following code:
>  
> var myGetXMLObj = new getXMLData(url,callBackFunction);
> myGetXMLObj.getData();
>  
> You get back a ready to use XML node that you can either append to
> the DOM (if SVG compatible) or parse per script.
>  
> I don't know how well it works with thousands of elements. Many of
> the current SVG viewers might not be fast enough to process huge
> amounts of data.
>  
> Andreas
>  
> --- In svg-developers@..., "david_bigd42" <mumrah@g...>
> wrote:
> >
> > Here is my problem. I have a static svg file, and at various
times
> i
> > will need to add additional svg to this document. I can do this
> for a
> > small number of elements with no problem via the createElementNS,
> > setAttribute, and appendChild methods. But now i need to add a
few

> > thousand elements at a time.  
> >  
> > I use and xmlhttp (ajax) transfer to get the new svg. The server
> > returns valid svg, and when i try to append the
> xmlhttp.responseXML to
> > the svg document, i get a type mismatch error thrown.  
> >  
> > Any ideas?
> >
>






------------------------ Yahoo! Groups Sponsor --------------------~-->
AIDS in India: A "lurking bomb." Click and help stop AIDS now.
http://us.click.yahoo.com/9QUssC/lzNLAA/TtwFAA/1U_rlB/TM
--------------------------------------------------------------------~->

-----
To unsubscribe send a message to: svg-developers-unsubscribe@...
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my membership"
----
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    svg-developers-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Re: problem dynamically adding svg

by pilatfr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I find a solution if objects are in svg with complete header
<svg version="1.1"
     baseProfile="full"
     xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink"
     xmlns:ev="http://www.w3.org/2001/xml-events"
....
objects
</svg>

Objects are draw and have correct URI for namespace in DOM Inspector

but it's heavy solution for single object to add ....

Michel


--- In svg-developers@..., "pilatfr" <pilat@w...> wrote:
>
> > You get back a ready to use XML node that you can either append
to
> > the DOM (if SVG compatible) or parse per script.
>
> I try this method to add widgets on user request .... but
> * objects are not draw ...
> * I cannot acceed objects to modify properties
> * objects are in DOM ( DOM inspector ) but URI for namespace is
empty
>
> How give svg namespace and see this objects?
>
> Michel
>
> PS I know that I can load this widgets at begining and show/hide
> them ... but as I have complicated widgets as filesystem or
more ...
> I prefer load them on request and remove them after using
>
> --- In svg-developers@..., "Andreas Neumann"
> <neumann@k...> wrote:
> >
> > in which SVG viewer/implementation?
> >  
> > ASV and Batik, e.g. don't support XMLHttpRequest. They support
> > getURL(). In order to support all of the viewers you must fork
your
> > code and see which method is available. You can write a helper
> > object or function for this.
> >  
> > http://www.carto.net/papers/svg/resources/helper_functions.js 
e.g.
> > has a getXMLData object that you could use for that purpose.
> >  
> > In order to use it, you can write the following code:
> >  
> > var myGetXMLObj = new getXMLData(url,callBackFunction);
> > myGetXMLObj.getData();
> >  
> > You get back a ready to use XML node that you can either append
to
> > the DOM (if SVG compatible) or parse per script.
> >  
> > I don't know how well it works with thousands of elements. Many
of
> > the current SVG viewers might not be fast enough to process huge
> > amounts of data.
> >  
> > Andreas
> >  
> > --- In svg-developers@..., "david_bigd42"
<mumrah@g...>
> > wrote:
> > >
> > > Here is my problem. I have a static svg file, and at various
> times
> > i
> > > will need to add additional svg to this document. I can do this
> > for a
> > > small number of elements with no problem via the
createElementNS,
> > > setAttribute, and appendChild methods. But now i need to add a
> few
> > > thousand elements at a time.  
> > >  
> > > I use and xmlhttp (ajax) transfer to get the new svg. The
server
> > > returns valid svg, and when i try to append the
> > xmlhttp.responseXML to
> > > the svg document, i get a type mismatch error thrown.  
> > >  
> > > Any ideas?
> > >
> >
>







------------------------ Yahoo! Groups Sponsor --------------------~-->
Most low income homes are not online. Make a difference this holiday season!
http://us.click.yahoo.com/5UeCyC/BWHMAA/TtwFAA/1U_rlB/TM
--------------------------------------------------------------------~->

-----
To unsubscribe send a message to: svg-developers-unsubscribe@...
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my membership"
----
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    svg-developers-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Re: problem dynamically adding svg

by Andreas Neumann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Michel,
 
see
 
http://www.carto.net/papers/svg/geturlxmlhttprequest/index.svg 
 
for a very simple example.
 
The corresponding php code looks like follows:
 
<?php
header('Content-type: text/xml');
$currentY = $_GET['currentY'];
print '<g xmlns="http://www.w3.org/2000/svg">'."\n";
print "\t".'<text x="50" y="'.$currentY.'" font-size="15">'.date("M
d Y H:i:s",time()).'</text>';
print "</g>\n";
?>
 
--------
 
it is important that the group that is appended has the xmlns
attrribute set to svg, if you add svg directly.
 
Also, note the "content-type" header, which should be provided.
Although it is my believe that this is not necessary if you use my
object, since I use the line
this.xmlRequest.overrideMimeType("text/xml"); to override whatever
the server sends as content-type (don't know if that actually really
works?).
 
All the best,
Andreas
 
 
--- In svg-developers@..., "pilatfr" <pilat@w...> wrote:

>
> I find a solution if objects are in svg with complete header
> <svg version="1.1"
>      baseProfile="full"
>      xmlns="http://www.w3.org/2000/svg"
>      xmlns:xlink="http://www.w3.org/1999/xlink"
>      xmlns:ev="http://www.w3.org/2001/xml-events"  
> ....
> objects
> </svg>
>  
> Objects are draw and have correct URI for namespace in DOM
Inspector
>  
> but it's heavy solution for single object to add ....
>  
> Michel
>  
>  
> --- In svg-developers@..., "pilatfr" <pilat@w...>
wrote:
> >
> > > You get back a ready to use XML node that you can either
append  

> to  
> > > the DOM (if SVG compatible) or parse per script.  
> >  
> > I try this method to add widgets on user request .... but  
> > * objects are not draw ...
> > * I cannot acceed objects to modify properties
> > * objects are in DOM ( DOM inspector ) but URI for namespace is  
> empty
> >  
> > How give svg namespace and see this objects?
> >  
> > Michel
> >  
> > PS I know that I can load this widgets at begining and show/hide  
> > them ... but as I have complicated widgets as filesystem or  
> more ...  
> > I prefer load them on request and remove them after using
> >  
> > --- In svg-developers@..., "Andreas Neumann"  
> > <neumann@k...> wrote:
> > >
> > > in which SVG viewer/implementation?  
> > >  
> > > ASV and Batik, e.g. don't support XMLHttpRequest. They support  
> > > getURL(). In order to support all of the viewers you must fork  
> your  
> > > code and see which method is available. You can write a helper  
> > > object or function for this.  
> > >  
> > > http://www.carto.net/papers/svg/resources/helper_functions.js 
> e.g.  
> > > has a getXMLData object that you could use for that purpose.  
> > >  
> > > In order to use it, you can write the following code:  
> > >  
> > > var myGetXMLObj = new getXMLData(url,callBackFunction);  
> > > myGetXMLObj.getData();  
> > >  
> > > You get back a ready to use XML node that you can either
append  
> to  
> > > the DOM (if SVG compatible) or parse per script.  
> > >  
> > > I don't know how well it works with thousands of elements.
Many  
> of  
> > > the current SVG viewers might not be fast enough to process
huge  

> > > amounts of data.  
> > >  
> > > Andreas  
> > >  
> > > --- In svg-developers@..., "david_bigd42"  
> <mumrah@g...>  
> > > wrote:  
> > > >  
> > > > Here is my problem. I have a static svg file, and at various  
> > times  
> > > i  
> > > > will need to add additional svg to this document. I can do
this  
> > > for a  
> > > > small number of elements with no problem via the  
> createElementNS,  
> > > > setAttribute, and appendChild methods. But now i need to add
a  

> > few  
> > > > thousand elements at a time.  
> > > >  
> > > > I use and xmlhttp (ajax) transfer to get the new svg. The  
> server  
> > > > returns valid svg, and when i try to append the  
> > > xmlhttp.responseXML to  
> > > > the svg document, i get a type mismatch error thrown.  
> > > >  
> > > > Any ideas?  
> > > >
> > >
> >
>
 





------------------------ Yahoo! Groups Sponsor --------------------~-->
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/KIlPFB/vlQLAA/TtwFAA/1U_rlB/TM
--------------------------------------------------------------------~->

-----
To unsubscribe send a message to: svg-developers-unsubscribe@...
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my membership"
----
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    svg-developers-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




Re: problem dynamically adding svg

by pilatfr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for input

A last problem with FF, how print svg with text?
I try font-size="10", font-size="10px" ... and I get very too big
letters ....

I post sudoku game runing with FF1.5, ASV3 and ASV6 beta
http://pilat.ouvaton.org/sudoku/sudoku.svg?l=english

Default language is french
http://pilat.ouvaton.org/sudoku/sudoku.svg

Thanks to
Jim (for getURL and postURL emulations)
Andreas (for getXMLData to load widgets)
and others ... FF fans

Michel

--- In svg-developers@..., "Andreas Neumann"
<neumann@k...> wrote:

>
> Hi Michel,
>  
> see
>  
> http://www.carto.net/papers/svg/geturlxmlhttprequest/index.svg 
>  
> for a very simple example.
>  
> The corresponding php code looks like follows:
>  
> <?php
> header('Content-type: text/xml');
> $currentY = $_GET['currentY'];
> print '<g xmlns="http://www.w3.org/2000/svg">'."\n";
> print "\t".'<text x="50" y="'.$currentY.'" font-size="15">'.date("M
> d Y H:i:s",time()).'</text>';
> print "</g>\n";
> ?>
>  
> --------
>  
> it is important that the group that is appended has the xmlns
> attrribute set to svg, if you add svg directly.
>  
> Also, note the "content-type" header, which should be provided.
> Although it is my believe that this is not necessary if you use my
> object, since I use the line
> this.xmlRequest.overrideMimeType("text/xml"); to override whatever
> the server sends as content-type (don't know if that actually
really
> works?).
>  
> All the best,
> Andreas
>  
>  
> --- In svg-developers@..., "pilatfr" <pilat@w...>
wrote:

> >
> > I find a solution if objects are in svg with complete header
> > <svg version="1.1"
> >      baseProfile="full"
> >      xmlns="http://www.w3.org/2000/svg"
> >      xmlns:xlink="http://www.w3.org/1999/xlink"
> >      xmlns:ev="http://www.w3.org/2001/xml-events"  
> > ....
> > objects
> > </svg>
> >  
> > Objects are draw and have correct URI for namespace in DOM
> Inspector
> >  
> > but it's heavy solution for single object to add ....
> >  
> > Michel
> >  
> >  
> > --- In svg-developers@..., "pilatfr" <pilat@w...>
> wrote:
> > >
> > > > You get back a ready to use XML node that you can either
> append  
> > to  
> > > > the DOM (if SVG compatible) or parse per script.  
> > >  
> > > I try this method to add widgets on user request .... but  
> > > * objects are not draw ...
> > > * I cannot acceed objects to modify properties
> > > * objects are in DOM ( DOM inspector ) but URI for namespace
is  
> > empty
> > >  
> > > How give svg namespace and see this objects?
> > >  
> > > Michel
> > >  
> > > PS I know that I can load this widgets at begining and
show/hide  

> > > them ... but as I have complicated widgets as filesystem or  
> > more ...  
> > > I prefer load them on request and remove them after using
> > >  
> > > --- In svg-developers@..., "Andreas Neumann"  
> > > <neumann@k...> wrote:
> > > >
> > > > in which SVG viewer/implementation?  
> > > >  
> > > > ASV and Batik, e.g. don't support XMLHttpRequest. They
support  
> > > > getURL(). In order to support all of the viewers you must
fork  
> > your  
> > > > code and see which method is available. You can write a
helper  
> > > > object or function for this.  
> > > >  
> > > >
http://www.carto.net/papers/svg/resources/helper_functions.js 

> > e.g.  
> > > > has a getXMLData object that you could use for that purpose.  
> > > >  
> > > > In order to use it, you can write the following code:  
> > > >  
> > > > var myGetXMLObj = new getXMLData(url,callBackFunction);  
> > > > myGetXMLObj.getData();  
> > > >  
> > > > You get back a ready to use XML node that you can either
> append  
> > to  
> > > > the DOM (if SVG compatible) or parse per script.  
> > > >  
> > > > I don't know how well it works with thousands of elements.
> Many  
> > of  
> > > > the current SVG viewers might not be fast enough to process
> huge  
> > > > amounts of data.  
> > > >  
> > > > Andreas  
> > > >  
> > > > --- In svg-developers@..., "david_bigd42"  
> > <mumrah@g...>  
> > > > wrote:  
> > > > >  
> > > > > Here is my problem. I have a static svg file, and at
various  
> > > times  
> > > > i  
> > > > > will need to add additional svg to this document. I can do
> this  
> > > > for a  
> > > > > small number of elements with no problem via the  
> > createElementNS,  
> > > > > setAttribute, and appendChild methods. But now i need to
add

> a  
> > > few  
> > > > > thousand elements at a time.  
> > > > >  
> > > > > I use and xmlhttp (ajax) transfer to get the new svg. The  
> > server  
> > > > > returns valid svg, and when i try to append the  
> > > > xmlhttp.responseXML to  
> > > > > the svg document, i get a type mismatch error thrown.  
> > > > >  
> > > > > Any ideas?  
> > > > >
> > > >
> > >
> >
>






------------------------ Yahoo! Groups Sponsor --------------------~-->
Most low income homes are not online. Make a difference this holiday season!
http://us.click.yahoo.com/5UeCyC/BWHMAA/TtwFAA/1U_rlB/TM
--------------------------------------------------------------------~->

-----
To unsubscribe send a message to: svg-developers-unsubscribe@...
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my membership"
----
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    svg-developers-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Re: problem dynamically adding svg

by Andreas Neumann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> A last problem with FF, how print svg with text?
> I try font-size="10", font-size="10px" ... and I get very too big
> letters ....

Hi Michel,

I am not a Mozilla SVG developer and don't have a fix for you, but can
confirm the problem with font-sizes when printing on Windows, as to
the following document:

http://developer.mozilla.org/en/docs/SVG_in_Firefox_1.5

"Currently printing is unfortunately not done using the vector
properties of SVG to generate extremely crisp output, but instead
rendered at screen resolution and then output as an image.

Font sizes when printing on MS-Windows will be much larger than
specified for SVG."

Andreas

>
> I post sudoku game runing with FF1.5, ASV3 and ASV6 beta
> http://pilat.ouvaton.org/sudoku/sudoku.svg?l=english

cool - thanks for sharing!

Andreas








------------------------ Yahoo! Groups Sponsor --------------------~-->
AIDS in India: A "lurking bomb." Click and help stop AIDS now.
http://us.click.yahoo.com/9QUssC/lzNLAA/TtwFAA/1U_rlB/TM
--------------------------------------------------------------------~->

-----
To unsubscribe send a message to: svg-developers-unsubscribe@...
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my membership"
----
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    svg-developers-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/