Read XML in VB

Any hint to get node values?

<P id= "7">6715845.982000 25498179.228000 70.484000</P>

so this is one point ? and you want
x = 6715845.982000
y = 25498179.228000
z = 70.484000
??

please upload your file - it s impossible to help from a screenshot.

Aim is to write script to have XML file converted into mesh. I tried through pancake plugin with Gh basic components but it was very slow with large xml files.
test.zip (18.8 MB)

test.gh (7.6 KB)

unzipping your 19MB zip will result in a 83MB xml.
That s no fun to look at or to play with.

ok so basically you want to read mesh / Terrain Data from a BIM file… (?)
Did you research if there isn t any plug-in that can do the job ?
Do you really need this functionality that often / need more performance that it s worth implementing it ?

I really recommend to check existing solutions and do not reinvent the wheel.
If you do your own implementation:

  • create / get a very small sample file (max 500 nodes) - this is much easier to debug
  • get a cascade of file-Size 1 - 2 - 4 - 10 - 20 - 50 - 100 MB for performance testing
  • check some basic xml tutorials
  • read the documentation of the xml file to make sure you cover all possible information (nodes / tags / attributes)
  • ask chat gpt and ask / prompt bottom up…

do you really need VB ? C# or phyton are more common in the Rhino-Community I think.

If it s a professional context, ask somebody who can code/program and pay that person.

Problem solved by referring to the correct namespace.

would be nice to post a working code / gh definition / solution - so others that find this topic do not end up in looking at (nearly useless) screenshots.

1 Like

Good point. Here is the code needed to access nodes of xml file:

Dim xmlDoc As New XmlDocument()
xmlDoc.Load(FilePath)

’ Check whether parse string contains data
If xmlDoc Is Nothing Then
A=“XML document not loaded.”
Else
A=“XML loaded successfully.”
End If

’ Create new namespace manager
Dim defaultNamespace As String = xmlDoc.DocumentElement.NamespaceURI
Dim nsManager As New XmlNamespaceManager(xmlDoc.NameTable)
nsManager.AddNamespace(“ns”, defaultNamespace)

’ Start accessing nodes (Read xmldocumentation for more help)…