On Friday 18 Jun 2010 17:02:39 saw wrote:
> Given one large XML file such as:
> <A>
> <B>
> <C><D><E E="Eattr"/><F F="Fattr"/><G/></D></C>
> <C><D><E E="Eattr"/><F F="Fattr"/><G/></D></C>
> <!-- many more <C> sub-trees -->
> </B>
> </A>
>
> I want to create many small XML files consisting of a Root element and
> the <C> sub-tree. I would like to copy the <C> sub-tree from input to
> output as a block without having to address the sub-components. I have
> read the input into a hash using XML::Simple, but don't know how to
> copy the sub-tree which is also a hash.
I think you can do it pretty easily with XML-LibXML and its DOM manipulation,
because you can serialise a sub-part of the DOM. I may get flamed for it, but
I really dislike XML-Simple.
Regards,
Shlomi Fish
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
List of Portability Libraries - http://shlom.in/port-libs
God considered inflicting XSLT as the tenth plague of Egypt, but then
decided against it because he thought it would be too evil.
Please reply to list if it's a mailing list post - http://shlom.in/reply .
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/