You can solve this by using XmlReader.ReadSubTree. For example:
if (xmlReader.Name == "vf:Vusc")
{
using (var subtree = xmlReader.ReadSubTree())
{
var item = ParseRegion(subtree);
repository.Save(item);
}
}
ReadSubTree
limits how much of the XML your ParseRegion
can see. When ParseRegion
returns, the reader is positioned at the end element of the tag that it was in. So your main reader loop won't ever see that inner "vf:Vusc" tag.