[XML-SIG] replacing parts of xml using xpath

Ajay abra9823 at mail.usyd.edu.au
Thu Sep 9 14:36:08 CEST 2004


the xpath construct would give you a single node or a list of nodes.
get the parent node, remove the current child node and add the node you'd
like to have instead.


Quoting Colin Gillespie <C.Gillespie at newcastle.ac.uk>:

> Dear All,
>
> Problem:
> Example xml file:
> <aaa>
> 	<bbb />
> 	<bbb />
> <aaa>
>
> I want to replace a part of the xml file, identified by an xpath
> construct with something else. For example,
> replace //bbb[2] with <ccc />
> To get
> <aaa>
> 	<bbb />
> 	<ccc />
> <aaa>
>
> Is this possible with pyxml & xpath? If not, can anyone suggest what
> would be the best way to tackling this problem.
>
> Thanks
>
> Colin Gillespie
> _______________________________________________
> XML-SIG maillist  -  XML-SIG at python.org
> http://mail.python.org/mailman/listinfo/xml-sig
>
>


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


More information about the XML-SIG mailing list