Buggy Find/Replace in Files with long lines and XPath

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
dsewell
Posts: 124
Joined: Mon Jun 09, 2003 6:02 pm
Location: Charlottesville, Virginia USA

Buggy Find/Replace in Files with long lines and XPath

Post by dsewell » Tue Dec 28, 2010 9:21 pm

I have just discovered that some XPath searches on project files are returning incomplete results, and I have identified the cause (or "a cause" at least) as long lines in the source XML.

Description:

I want to search through all files in a project for a regular expression \d\s+\d (match digits separated by space) within the XML element <pg>. My XML files contain elements like this:

Code: Select all

<entry><head>House, Mrs. Mary</head><pgW><pg>2</pg><pg>13 and n.</pg><pg>55</pg><pg>173–74 n. 1</pg><pg>178</pg><pg>196</pg><pg>272 n. 1</pg><pg>308</pg><pg>345 n.1 449</pg></pgW></entry>
where the regex search should match the final <pg> element in the given <entry>.

Running Find/Replace in my project files failed to match this data.

I then tried format-and-indent on the source, to produce

Code: Select all

    <entry>
<head>House, Mrs. Mary</head>
<pgW>
<pg>2</pg>
<pg>13 and n.</pg>
<pg>55</pg>
<pg>173–74 n. 1</pg>
<pg>178</pg>
<pg>196</pg>
<pg>272 n. 1</pg>
<pg>308</pg>
<pg>345 n.1 449</pg>
</pgW>
</entry>
saved the file, and then I ran the project search again. This time the final <pg> was correctly matched.

The *only* thing I changed in the file was whitespace in the formatting. So this appears to be a bug in the oXygen search in cases of long lines.

Radu
Posts: 7143
Joined: Fri Jul 09, 2004 5:18 pm

Re: Buggy Find/Replace in Files with long lines and XPath

Post by Radu » Wed Dec 29, 2010 9:51 am

Hi David,

I can confirm this was a bug in the Find Replace in Files with XPath filters.
Only the first element on the line matching the XPath was considered.
We fixed this about a week ago due to another report and the fix will be available in Oxygen 12.1 (in a couple of weeks).
If you want to test an Oxygen 12.1 beta kit just write us on the support email address and we'll try to provide you with a download link.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

dsewell
Posts: 124
Joined: Mon Jun 09, 2003 6:02 pm
Location: Charlottesville, Virginia USA

Re: Buggy Find/Replace in Files with long lines and XPath

Post by dsewell » Wed Dec 29, 2010 9:29 pm

Excellent, thank you!

Post Reply