Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/ExtendedXmlSerializer/ExtensionModel/Xml/XmlContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ public bool MoveNext()
{
var attributes = _attributes;
var content = _elements;
var result = (attributes?.MoveNext() ?? false) || (content?.MoveNext() ?? false);
return result;
return content?.IsEmpty() ?? false ? (bool)content?.MoveNext() : Next(in attributes, in content);
}

static bool Next(in XmlAttributes? attributes, in XmlElements? content)
=> (attributes?.MoveNext() ?? false) || (content?.MoveNext() ?? false);

public object Current => null;
}
}
2 changes: 2 additions & 0 deletions src/ExtendedXmlSerializer/ExtensionModel/Xml/XmlElements.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ public XmlElements(System.Xml.XmlReader reader, int depth)
public bool MoveNext() => _reader.Read() && _reader.IsStartElement() && _reader.Depth == _depth;

public object Current => _reader;

public bool IsEmpty() => _reader.IsEmptyElement;
}
}