This is what I did,

var nodenew = parseXML("<g id='newnode'/>", document);
grpAtt.appendChild(nodenew);

Thanks
Nathan.

-- In svg-developers@yahoogroups.com, "Martin Honnen" 
<[EMAIL PROTECTED]> wrote:
>
> --- In svg-developers@yahoogroups.com, "sent1729" <[EMAIL PROTECTED]> 
wrote:
> 
> >   Is it possible to add a string (which is an svg(xml)) as a node
> > ( for e.g. < svg ....>
> >               <g...../>
> >            </svg>)
> > 
> > to an svg document.
> 
> You need tools to parse the SVG markup into DOM nodes, then you can
> use the DOM methods appendChild, insertBefore, at least after using
> importNode.
> For Firefox 1.5 you can use DOMParser e.g.
> 
> // constructing string here for better readability of the post
> var exampleSVGMarkup = [
>   '<svg xmlns="http://www.w3.org/2000/svg";',
>   '   width="100" height="100">',
>   '<circle cx="50" cy="50" r="30" fill="green" />',
>   '</svg>'
> ].join('\r\n');
> 
> if (typeof DOMParser != 'undefined') {
>   var xmlDocument = new DOMParser().parseFromString(
>     exampleSVGMarkup,
>    'application/xml'
>   );
>  
> someElement.appendChild(someElement.ownerDocument.importNode
(xmlDocument.documentElement,
> true));
> }
> 
> 
> Adobe SVG viewer has a method parseXML, see
>   <http://wiki.svg.org/ParseXML>
> 
> 
> > I have added svg elements to an svg document by using var a = 
> > createElement(string)and doc.appendchild(a). But in the above 
mentioned 
> > case the whole element(<svg ..><g..../></svg>) is stored as a 
string in 
> > my code. My question how to add this string which is an svg 
document. 
> > Do I have to convert this string to a node before adding it to 
the svg 
> > document?. Are there any methods available to do this.
> > 
> > Please help.
> > 
> > Thanks
> > Nathan.
> >
>






-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-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:
    [EMAIL PROTECTED]

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


Reply via email to