in reply to Re: Perl Hash to XML
in thread Perl Hash to XML

so if i got it right, you are suggesting that i copy contents from an existing file, and push it into a new file(new by name of just replacing the old one) along with the additional data i am pushing in this time. :)

sure XML::SIMPLE would do that, but there's ought to be a simpler way. right?

Replies are listed 'Best First'.
Re^3: Perl Hash to XML
by Perlbotics (Archbishop) on Aug 18, 2008 at 21:22 UTC
    It depends... Do you mean simple in the sense of performance? Well, who says that your existing XML file has to be treated as such (parsed and validated)? Seek to the end of the file, before the </a>, add another <b>...</b></a> sequence and done. But I guess, you want a little bit more than that...and a little bit more robustness?
    The previous suggestion is simple to program, but surely not the fastest way to append a node to a (potentially large) file.
      i think i could do with that, my xml files would only contain two to max 3 child nodes. each one added one at a time.

      So i guess I could use this approach. Which is not the best approach considering robustness, but again, simplicity is the requirement...

      however, it would be nice to learn how to do it in a more robust way esply since I have another task on hand where have more than 200 nodes.