Reputation: 23
I'm having a strange issue and I can't really find the cause. It just suddenly stopped working and I don't know what triggered it.
I'm using XMLReader
in C# to read an xml file. I'm reading the values from the xml file like this:
if(subReader2.MoveToAttribute("X"))
float.TryParse(reader.Value, NumberStyles.Any
, CultureInfo.InvariantCulture, out pt.point.X);
The xml contains a tag like this:
<Point X="0" Y="0" Easing="Linear" EaseIn="True" EaseOut="True" />
When it reads the attributes X
and Y
, reader.Value
returns \n
for some reason. It has worked before, but something is stopping it now. The attributes, Easing, EaseIn and EaseOut are being read just fine. So I have no idea why X
and Y
would fail.
Any ideas?
Upvotes: 2
Views: 214
Reputation: 28839
When you have read.Value
, shouldn't that be subReader2.Value
?
Upvotes: 3
Reputation: 101690
The problem here is that you are pointing subReader2
at the X attribute and then taking a value from reader
. Is there a reason you're using a separate reader for each loop?
Upvotes: 2