<community>of XML and SVG Developers</community>
This is a discussion on Saving svg within the SVG Questions forums, part of the SVG Forums category; Hello everyone, i 'm drawing some svg's Shape dynamically inside a <g id="Dessiner">. My problem is that when i am ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| i 'm drawing some svg's Shape dynamically inside a <g id="Dessiner">. My problem is that when i am recording the shapes i need to do it in a group.Otherwise when i try to open this file only the first shape appear. Does anyone know how to record my file without adding a group? When i open my file i would like <g id="Dessiner"> to be the first parent. Thanks in advance, s?bastien. |
| |||
| Quote:
Michel |
| |||
|
Hello Michel, No i am not working with asv6 yet. I have tried to do what you told to, but i have difficulties to succeed.Here's my code: Dess = svgdoc.getElementById("Dessiner"); if(data.success) { var Long=data.content.length; message=data.content.substring(4,Long-4); //message=data.content.getChildNodes;alert(message); new_node =parseXML(data.content, document); Dess.appendChild(new_node); } messge is the data.content without the <g> and </g>. That is what i would like , but if i put it instead of data.content; only my first group will appear. Do you have any idea? Thanks in advance, s?bastien. |
| |||
| Quote:
If you parse data.content, you get your group and have to append all childs You can use that : if (data.success) { var doc_frag = parseXML ( data.content, document); childs=doc_frag.childNodes number=childs.length for (i=0;i<number;i++) { child=childs.item(i) Dess.appendChild (child) } } Michel |
| |||
|
Michel, it is not working yet. When i do an alert on my clipboard content, i can see two <g> and </g>. here is my code for the clipboard and your code to read the file. function Clipboard() { shapes = Dess.childNodes; Compteur = shapes.length; if(top.clipboardData) { NewSVG =""; for(i=0; i<Compteur; i++) { NewSVG +=printNode(shapes.item(i)); } NewSVG='<g>'+NewSVG+'</g>'; top .clipboardData.setData("Text", NewSVG); alert(NewSVG); } else alert("Vous devez creer des objets pour pouvoir utiliser cette fonction"); } function Importer(reponse) { //reponse=prompt("Choisissez un fichier"); getURL("Dossier Perso\\"+reponse+".svg", fileLoaded); } function fileLoaded(data) { if(data.success) { new_node =parseXML(data.content, document); var nouv=new_node.childNodes; compte=nouv.length; for(i=0; i<compte; i++) { child=nouv.item(i); Dess.appendChild(child); } } else { alert('Loading has failed'); } } Thanks, a plus s?bastien. |
| |||
| Quote:
function Clipboard() { if(top.clipboardData) { NewSVG=printNode(Dess) alert(NewSVG); } else alert("Vous devez creer des objets pour pouvoir utiliser cette fonction"); } Michel Michel |
| |||
| Quote:
Change id or remove it before saving. When you record on existing file, arrange your objects with server language. Michel |
Printer Inks
Get high quality printer inks from Prink. We have over 50,000 ink cartridges in stock. Free UK delivery on compatible ink cartridges for your printer.
epson ink cartridges
Discount Epson ink Cartridges from Internet Ink. Some of the cheapest Ink cartridges online.
HARD DISK DRIVE DATA RECOVERY CHESHIRE
Professional, prompt and cost effective hard disk drive data recovery. Click above!