How to check if there is an XML element inside a text element?

I would like to know how I can check the current situation:

<foo>
    <bla1>xxx</bla1>
    <bla2>yyy</bla2>
    <bla3>zzz</bla3>
</foo>

While (reader.Read ()), I fall in XmlNodeType.Element when I am in foo and bla1, bla2, bla3 ... When .TextElement in xxx, yyy, zzz falls out, But can I check will bla have a text value inside or not?

Many thanks

Pedro Dusso

+5
source share
3 answers

No, you cannot if using XmlReader .

The XmlReader class implements the cursor only for direct access through the XML hierarchy. Thus, you can only work with the XML node found in the current position.

, "bla", .

+2

XmlTextReader, IsEmptyElement

0

Is there something wrong with reader.HasValue? (or string.IsNullOrEmpty (reader.Value))?

0
source

All Articles