Page 1 of 1

Buggy Find/Replace in Files with long lines and XPath

Posted: Tue Dec 28, 2010 9:21 pm
by dsewell
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.

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

Posted: Wed Dec 29, 2010 9:51 am
by Radu
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

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

Posted: Wed Dec 29, 2010 9:29 pm
by dsewell
Excellent, thank you!