public virtual void ReadXml(System.Xml.XmlReader reader)
{
if (reader.ReadToDescendant("ContainerElement") == false)
{
throw new MyException("could not find the start of element ContainerElement");
}
int depth = reader.Depth;
reader.ReadToDescendant("xx1:containee");
reader.ReadToNextSibling("xx2", "Containee2");
reader.ReadToNextSibling("Containee3");
// moved to closing ContainerElement
while (reader.Depth > depth && reader.Read())
{
}
int counter = 0;
const int NODES_AT_END = 1;
while (reader.Read())
{
counter++;
}
if (counter != NODES_AT_END)
{
throw new MyException(String.Format("expected {0} nodes, but found {1}", NODES_AT_END, counter));
}
}