my code is the following:
the Read() method positions the cursor on the <conditiontag (verified
with debugger).
XmlReaderSettin gs s = new XmlReaderSettin gs();
s.IgnoreComment s = true;
s.IgnoreWhitesp ace = true;
s.IgnoreProcess ingInstructions = true;
using (XmlReader reader = XmlReader.Creat e("class.xml" , s))
{
reader.Read();
reader.ReadElem entContentAsStr ing();
}
the xml is:
...
<conditiontes t </condition>
...
Then an Exception is thrown which reads (translated from german):
The 'ReadElementCon tentAs()' method is not allowed to be called on
elements with sub-elements. line 7, position 12.
I do not understand this, in <conditionthe re is definitely no sub-element.
the Read() method positions the cursor on the <conditiontag (verified
with debugger).
XmlReaderSettin gs s = new XmlReaderSettin gs();
s.IgnoreComment s = true;
s.IgnoreWhitesp ace = true;
s.IgnoreProcess ingInstructions = true;
using (XmlReader reader = XmlReader.Creat e("class.xml" , s))
{
reader.Read();
reader.ReadElem entContentAsStr ing();
}
the xml is:
...
<conditiontes t </condition>
...
Then an Exception is thrown which reads (translated from german):
The 'ReadElementCon tentAs()' method is not allowed to be called on
elements with sub-elements. line 7, position 12.
I do not understand this, in <conditionthe re is definitely no sub-element.
Comment