Firstly, excuse me for the akward terminologies, I’m no programmer, but have lots of experience with gh.
Short description of the end goal:
I want to read an xml file (containing information on a list of materials) with gh, and extract the properties of the materials, so that gh can automatically read these xml files and create materials and constructions from that.
In the xml the materials are listed by index, so every material will start with:
BuildingMaterial Idx=“3” Name=“insulation”
…then it will contain a list of information, like so:
EmbodiedCarbon>1.08</EmbodiedCarbon
The information cannot be recognized by which #row it will be in, as this will be different for each document.
I’m sure there’s a way to do a python script that will read and extract, and I hope for your help with figuring out how!
Best way to approach this is to use an XML parsing lib that allows you to search for the <BuildingMaterial> tags and extract the information you need from it.
From the document you’d get all XML nodes called <BuildingMaterial>, then for each node you look at its attributes and child nodes.
Since you are looking to do this in Rhino Python I suggest using the System.Xml namespace.