Issue with XMLReader behaviour

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
While using XMLReader.ReadToFollowing to read the XML doc I found that it skips records if newline character is not present.
e.g.

<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; Root<span style="color:Blue; >

<span style="color:Blue; <<span style="color:#A31515; A<span style="color:Blue; >Jim<span style="color:Blue; </<span style="color:#A31515; A<span style="color:Blue; >

<span style="color:Blue; <<span style="color:#A31515; A<span style="color:Blue; >Bill<span style="color:Blue; </<span style="color:#A31515; A<span style="color:Blue; ><span style="color:Blue; <<span style="color:#A31515; A<span style="color:Blue; >Gates<span style="color:Blue; </<span style="color:#A31515; A<span style="color:Blue; >

<span style="color:Blue; <<span style="color:#A31515; A<span style="color:Blue; >Jeff<span style="color:Blue; </<span style="color:#A31515; A<span style="color:Blue; >

<span style="color:Blue; </<span style="color:#A31515; Root<span style="color:Blue; >
[/code]




<div style="color:Black;background-color:White; <pre>
XmlReader _reader = XmlReader.Create(fileName);

 <span style="color:Blue; bool recordFound = <span style="color:Blue; true;

 <span style="color:Blue; do

            {
<span style="color:Blue; string strChunk = <span style="color:#A31515; "";

                <span style="color:Blue; if( _reader.ReadToFollowing(<span style="color:#A31515; "A"))
strChunk = _xmlTextReader.ReadOuterXml();

                recordFound = <span style="color:Blue; string.IsNullOrEmpty(strChunk) ? <span style="color:Blue; false : <span style="color:Blue; true;

            }

            <span style="color:Blue; while (recordFound);



[/code]

in the above example ... it will skip "Gates".. Is there any fix for this... Please let me know .

Regards,
M <hr class="sig C# developer

View the full article
 
Back
Top