I'm implementing a custom XmlTextWriter and I'd like to omit any elements with a particular name that contain no attributes. I've gotten as far as being able to prevent the element from being written by overriding WriteStartElement
and WriteEndElement
, but is there a way to know at WriteStartElement
or at any other useful point whether or not the element has any attributes?
Asked
Active
Viewed 278 times
1

HotN
- 4,216
- 3
- 40
- 51
1 Answers
0
No. However you can postpone writing of the element and attributes (put them in a field) until you get to the next element/comment/etc. Then decide whether you want to write them or not.

Andrey Shchekin
- 21,101
- 19
- 94
- 162