Maxscript XML help :)

Hey everyone

So i’m working on a simple XML tool to bring in some data into max, it’s to load specific objects from a max file where there might be hundreds.

Here’s the trouble, i have an example xml that looks like this


<OutputCreation>
	<BaseModel>
		<Model>BASEUNIT</Model>
		<DiffuseTexture>BASEUNIT_D.TGA</DiffuseTexture>
		<NormalTexture>BASEUNIT_N.TGA</NormalTexture>
	</BaseModel>
</OutputCreation>

pretty darn simple xml file but it’s stumping me. I can go through the xml file and return the string BaseModel, but i can’t get any information on it’s children!

i’m using XMLStruct.ms written by David Mackenzie to simply things. So for the code to work you’d need his script in your startup but this is what my code looks like so far, this isn’t the whole script, just the part that deals with reading the xml

(
format "%
" objPath
xDoc = XMLDocument()										--Create an XMLDcoument
xDoc.LoadXML testPath 								--Load XML from file
rNode = xDoc.GetRootNode()									--Get the Root Node THIS MUST BE CALLED!
childs = rNode.GetChildren() 									-- Get all child nodes of the root node

format "%
" rNode
for i = 1 to childs.count do -- Main loop for workign with child nodes
(
	--format "%
" (childs[i].GetAttribute "data")	
	tagnames = (childs[i].GetTag())
	if tagNames != "#comment" then
	(
		format "tagNames printed inside no comment loop = %
" tagNames
		subNode = xdoc.getNewNode tagNames
		format "subNode = %
" subNode.tag
		childsOfRoot subNode
		subChild = subNode.tag.GetChild subNode--subNode.getChildren()
		/*subAtt = subNode.GetAllAttributes()
		format "subchild = %
" subChild
		format "subAtt = %
" subAtt*/
		--format "moretagsname = %
" moretagsnames
	)
	
	
	
)

If someone could help shed some light onto how i get the children of <basemodel> that would be amazing thankyou!

foo = childs[i].getChildren()
foo[1].getText()

etc… ?

SamiV.