Brady, Phillip wrote:
> I have an SVG / XML / DOM question I was hoping maybe you folks could offer
> some opinions on.  Basically it is simply when or when not to use DOM to
> manipulate XML (in this case SVG... but also generically speaking)?  As an
> example, I put together a little application in which I am periodically (15
> seconds) constructing an XML file for data output to other processes.  I
> originally wrote this app building the xml file using the dom to create
> elements, append them, etc... piece by piece.  This was also a simple
> educational process for me to learn about the dom.  I then stepped back and
> looked at the output from the perspective of a simple text string and had
> the realization that I could create the same xml file much cleaner and
> simpler (in code at least) simply by building the file line by line, string
> by string... without using the dom at all...  So, my question to you is
> this... in the context of building an xml file... what benefits does using
> the dom offer that simply constructing a text file does not?

Well, in case of SVG, my point of view would be:
You can't escape Dom when you want to manipulate SVG from the inside, 
ie. with JavaScript.

But to build a file from scratch with an external language (C*, Java, 
Lua, Basic, Python, Perl, whatever), and without needing to change it 
dynamically, I believe you are better creating data with the best fit in 
the chosen language (tables, arrays, API, etc.) then transform that into 
XML for output. Or even with plain text output, or template system.

Well, using the Dom approach can have the advantage of using a familiar 
way of thinking, if you are used to that.
And some algorithms may need insertion of nodes inside the structure, 
but the data structure approach allows that too.

-- 
Philippe Lhoste
--  (near) Paris -- France
--  Professional programmer and amateur artist
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --


------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/1U_rlB/TM
--------------------------------------------------------------------~-> 

-----
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