Search for xml tags with line break

Questions about XML that are not covered by the other forums should go here.
jeofree
Posts: 5
Joined: Tue May 03, 2011 5:54 am

Search for xml tags with line break

Post by jeofree »

This will be a newbie question so bear with me:

How can I use Oxygen to search a collection of DITA xml files for <ul or <ol occurrences only after a closing paragraph tag-- even if on the next line? In other words, finding all instances of this:

Code: Select all

</p> 
<ol
I just want to find places where either unordered or ordered lists have been started outside of the paragraph instead of inside it, and having no luck using regular expressions to find it because of the line break.

Please give as much detail as you can if responding.

Thanks,
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Search for xml tags with line break

Post by adrian »

Hello,

Use the Find Replace in Files dialog with the following settings.
1. Text to find:

Code: Select all

(<ul|<ol)
2. Enable "Regular expression".
3. Restrict to XPath:

Code: Select all

//(ul|ol)[name(preceding-sibling::*[1])='p']
4. Scope: the folder or selection of your DITA files.

What the XPath does is: It looks for all ul and ol elements(//(ul|ol)) which have the first preceding element(preceding-sibling::*[1]) named 'p'(name(...)='p').

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
jeofree
Posts: 5
Joined: Tue May 03, 2011 5:54 am

Re: Search for xml tags with line break

Post by jeofree »

Adrian,

Thanks, that's perfect.
Post Reply