[fedora-java] xml manipulation
Mikolaj Izdebski
mizdebsk at redhat.com
Wed Mar 11 06:17:41 UTC 2015
On 03/11/2015 12:06 AM, Orion Poplawski wrote:
> On 03/10/2015 01:17 AM, Mikolaj Izdebski wrote:
>> On 03/09/2015 09:10 PM, Orion Poplawski wrote:
>>> Is it possible to use %pom_xpath_remove (or similar) to edit an arbitrary xml
>>> file? I'd like to remove from:
>>
>> Yes, it should work.
>>
>>> releng/org.eclipse.ptp.repo/category.xml:
>>>
>>> <site>
>>> ...
>>> <feature url="features/org.eclipse.ptp.rdt.sync.fortran_0.0.0.jar"
>>> id="org.eclipse.ptp.rdt.sync.fortran" version="0.0.0">
>>> <category name="Remote Development Tools"/>
>>> </feature>
>>> ...
>>> </site>
>>
>> I've just verified it with:
>>
>> $ cat /tmp/feature.xml
>> <site>
>> <feature url="features/org.eclipse.ptp.rdt.sync.fortran_0.0.0.jar"
>> id="org.eclipse.ptp.rdt.sync.fortran" version="0.0.0">
>> <category name="Remote Development Tools"/>
>> </feature>
>> </site>
>>
>> $ python3 /usr/share/java-utils/pom_editor.py pom_xpath_remove feature
>> /tmp/feature.xml
>>
>> $ cat /tmp/feature.xml
>> <site>
>> </site>
>>
>>
>
> Ah, sorry, I should have been a little more clear. There are several
> <feature> items, but I only want to remove that specific one. I don't know
> how to name that.
For that you can use something like:
%pom_xpath_remove "feature[@id='org.eclipse.ptp.rdt.sync.fortran']"
This will remove any feature node with given id.
--
Mikolaj Izdebski
Software Engineer, Red Hat
IRC: mizdebsk
More information about the java-devel
mailing list