I basically have this Code in VB.NET
xmlline = "<elements>etc..</elements> <!-- Some random Comment -->"
Dim XMLInput As XElement
XMLInput = XElement.Parse(xmlline)
and the comment is throwing and exception however i place it. As both "double root element" and "unexpected end of comment"
and have seen some suggesting to be using this reader instead with the optional parameter
Dim xmlsettings As New XmlReaderSettings With {
.IgnoreComments = True
}
XmlReader.Create(XMLtextfile, xmlsettings)
but cant get it to work, and furthermore, the Xelement way of accessing the different parts of the tree is working so good for me.
like doing this: Dim XMLROOT As XElement = XMLInput.Element("ImportData").Element("UsagePoints").Element("UsagePoint")
XMLROOT.Element("Address").Element("Street").Value
So how can i read XML textfiles containing XML structure with comments without getting an error ?