I can't reproduce that with your example code, are you certain that you're
on the correct element?
Have you output reader.LocalName?
--
Joe Fawcett (MVP - XML)
http://joe.fawcett.name
"cody" <deutronium@gmx.dewrote in message
news:uXKfeUP7IHA.1192@TK2MSFTNGP05.phx.gbl...
Quote:
my code is the following:
the Read() method positions the cursor on the <conditiontag (verified
with debugger).
>
XmlReaderSettings s = new XmlReaderSettings();
s.IgnoreComments = true;
s.IgnoreWhitespace = true;
s.IgnoreProcessingInstructions = true;
>
using (XmlReader reader = XmlReader.Create("class.xml", s))
{
reader.Read();
reader.ReadElementContentAsString();
}
>
the xml is:
>
..
<conditiontest </condition>
..
>
Then an Exception is thrown which reads (translated from german):
>
The 'ReadElementContentAs()' method is not allowed to be called on
elements with sub-elements. line 7, position 12.
>
I do not understand this, in <conditionthere is definitely no
sub-element.