Page 1 of 1
Globally Delete all 6 level Paragraphs
Posted: Fri Mar 24, 2023 6:51 pm
by binar
I am using OxygenXML Editor. I have an XML file which has a lot of nested "procedural step" tags that drill down six paragraph levels down. However, the BREX allows a maximum of 5 paragraph levels. Does OxygenXML Editor have a toolset that will allow me to GLOBALLY select all the 6 Level Paragraphs in the XML document so I can delete them all with a single touch to the DELETE button? Or does OxygenXML have a toolset that will allow me to filter the entire XML so it only displays 6 Paragraph Level ProceduralStep tagged data? Any help will be greatly appreciated. Thank you for your time.
Re: Globally Delete all 6 level Paragraphs
Posted: Fri Mar 24, 2023 7:00 pm
by chrispitude
This should be straightforward. Could you post a minimal example with "before" and "after" XML content?
Re: Globally Delete all 6 level Paragraphs
Posted: Sat Mar 25, 2023 5:48 am
by binar
Chris, thank you for your post. Below are BEFORE and AFTER examples of the operation I am seeking OxygenXML Editor to perform. It involves targeting all proceduralStep para Level 6 tags within an XML file so that they can easily be deleted. Any advice you can offer will be greatly appreciated. Thank you for your time.
BEFORE proceduralStep para Level 6 tag Removal:
Code: Select all
<proceduralStep Id="Para0001">
<para>Para Level 1</para>
<proceduralStep Id="Para0002">
<para>Para Level 2</para>
<proceduralStep Id="Para0003">
<para>Para Level 3</para>
<proceduralStep Id="Para0004">
<para>Para Level 4</para>
<proceduralStep Id="Para0005">
<para>Para Level 5</para>
<proceduralStep Id="Para0006">
<para>Para Level 6</para>
</proceduralStep>
</proceduralStep>
</proceduralStep>
</proceduralStep>
</proceduralStep>
</proceduralStep>
AFTER proceduralStep para Level 6 tag Removal:
Code: Select all
<proceduralStep Id="Para0001">
<para>Para Level 1</para>
<proceduralStep Id="Para0002">
<para>Para Level 2</para>
<proceduralStep Id="Para0003">
<para>Para Level 3</para>
<proceduralStep Id="Para0004">
<para>Para Level 4</para>
<proceduralStep Id="Para0005">
<para>Para Level 5</para>
</proceduralStep>
</proceduralStep>
</proceduralStep>
</proceduralStep>
</proceduralStep>
Re: Globally Delete all 6 level Paragraphs
Posted: Sat Mar 25, 2023 4:36 pm
by chrispitude
Hi binar,
Try running the
Delete Element refactoring operation (
Tools > XML Refactoring). For the
Element pattern, use this:
Code: Select all
proceduralStep[count(ancestor::proceduralStep) >= 5]
In the
Scope and Filters dialog, set the scope to what you want. For example, to run on all .xml files in a particular directory, you would first select that directory in the
Project view, then you would set the scope to
Selected project resources and the
Include files filter to *.xml.
This deletes the elements completely. You could also unwrap the elements and keep the content if you want, using a different refactoring operation.
- Chris