[fedora-java] xml manipulation

Orion Poplawski orion at cora.nwra.com
Thu Mar 12 02:48:47 UTC 2015


On 03/11/2015 12:17 AM, Mikolaj Izdebski wrote:
> 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.
>
Thanks again!

-- 
Orion Poplawski
Technical Manager                     303-415-9701 x222
NWRA/CoRA Division                    FAX: 303-415-9702
3380 Mitchell Lane                  orion at cora.nwra.com
Boulder, CO 80301              http://www.cora.nwra.com


More information about the java-devel mailing list