Bug 4739 - XPathNavigator.Select doesn't select child node embedded between text nodes
Summary: XPathNavigator.Select doesn't select child node embedded between text nodes
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.XML ()
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-04-30 10:11 UTC by eb1
Modified: 2014-07-22 03:16 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Unit test that demonstrates the problem (1.32 KB, patch)
2012-04-30 10:27 UTC, eb1
Details
Suggested fix (966 bytes, patch)
2012-04-30 10:27 UTC, eb1
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description eb1 2012-04-30 10:11:45 UTC
Consider the following code snippet:

string xml = "<root><one><two>A<three>B</three>C</two></one></root>";

var doc = XElement.Parse(xml);
var it = otherDoc.CreateNavigator().Select("//one");
it.MoveNext();
var one = it.Current;
var three = one.Select("two/three");
three.MoveNext();
Console.WriteLine(three.Current.InnerXml);

Expected Output:
B

Actual Output:
NullReferenceException because three.Current is null.
Comment 1 eb1 2012-04-30 10:27:19 UTC
Created attachment 1777 [details]
Unit test that demonstrates the problem
Comment 2 eb1 2012-04-30 10:27:37 UTC
Created attachment 1778 [details]
Suggested fix
Comment 3 Atsushi Eno 2012-05-14 03:25:42 UTC
Oops, stupid bug. I just applied your fix. Thanks!
Comment 4 heebaek choi 2014-07-20 23:19:33 UTC
This bug may not fixed for XAMARIN ANDROID.

i have Xamarin.Android
Version: 4.12.6 (Indie Edition)

i have no problem on Xamarin.iOS
Version: 7.2.5.5 (Indie Edition)

Please see this problem again.
Comment 5 Atsushi Eno 2014-07-22 03:03:09 UTC
I cannot really reproduce the issue. If you are seeing problem with related to XPath but not from the exact code shown above, we need a reproducible code.
Comment 6 heebaek choi 2014-07-22 03:16:54 UTC
sorry bug was in my code.
thanks for your feedback.