I've been watching a bunch of videos about how to read XMLs with Visual Basic and I believe I'm following the correct steps, but I keep getting the error
BC30456 getElementsByTagName is not a member of 'XDocument'
This is the code I have:
Dim document As New XDocument
Dim nodoLista As XmlNodeList
Dim nodo As XmlNode
document = XDocument.Load(path)
nodoLista = document.getElementsByTagName("Empresa")
I've looked for a replacement, maybe the code is old and was updated, but can't find ANYTHING, not even a similar error. I've also tried SelectNodes
, but same error appears. Also I have the imports system.xml
btw.
Also tried
nodoLista = document.Elements("Empresa")
but I get the error
Based in your code seems like you wanted to code around Xml.XmlDocument
instead of Xdocument
as getElementsByTagName
is a Function of Xml.XmlDocument
(or its elements descendatnts) which return a XmlNodeList
Here your code (modified):
Dim document As New Xml.XmlDocument
Dim nodoLista As Xml.XmlNodeList
Dim nodo As XmlNode
document.Load(path)
nodoLista = document.GetElementsByTagName("Empresa")