I'm very new to XML parsing and don't really know what I'm doing. I'm trying to parse a file in XML, but have encountered this error:
System.Xml.XmlException: ''Element' is an invalid XmlNodeType.'
Here's the code below:
Dim settings As XmlReaderSettings = New XmlReaderSettings
settings.DtdProcessing = DtdProcessing.Parse
Dim xmlR = XmlReader.Create(jmdictpath, settings)
Do While xmlR.Read()
If Not xmlR.IsEmptyElement And xmlR.NodeType = XmlNodeType.Element Then
MsgBox(xmlR.ReadElementContentAsString)
End If
Loop
The error runs on the line MsgBox(xmlR.ReadElementContentAsString). I've tested that the element is not empty, so that shouldn't be a problem.
Then I checked the xmlReader object in QuickWatch, and it looks like what the object is currently trying to read is a whitespace or line return character:
Is there some standard method to handle all cases like this when parsing XML so that whitespace characters don't get picked up as XML tags and confuse the reader?

Notwith yourAnd. Are you sure it is evaluating like ((Not first) and second) vs (not(first and second))? Try adding some parens and let us know if it behaves differently.