Notifications
Clear all

[Closed] Parsing XML with ActiveX Microsoft.XMLDOM

Hi all,
I’m having troubles trying to use this ActiveX component, but this problem concerns every ActiveX component.
How do I retrieve arrays ?

I am suppose to access its array properties using “getIndexedProperty”. ok
but how do I access arrays returned by its methods ?

I have an IXMLDOMNode, and I want to use its method selectNodes that is supposed to return an array, but if I do

result = myNode.selectNodes("queryString")

result is undefined…

EDIT: Correction of the big mistake

11 Replies

you do realise that you have a typo in the word “result”?

lol, my fault on this one, but this is just an example of what I am doing, written for the post. I don’t have this mistake on my code:)

So I still have my problem, any ideas before I try another approach to parse my files ?

Hi charles_magne,

In fact selectNodes method returns undefined because the parameter of this method isn’t good. selectNodes() expects the path to the node you want to retrieve the childs.

I’ve developed a small Collada reader in MAXSCript with Microsoft.XMLDOM before.
and I’ve used this function as follow for example :

libNodes = xmlDoc.selectNodes "//COLLADA/library"

Now with 3ds Max 9 you can use .NET Framework 2.0 in order to perform XML operations.

Thanks ypuech,

Is the path in XPath format ?

Concerning Max9, I think it is not yet released in France… And when it is release, it will take some time to buy…

Is the path in XPath format ?

It seems that it’s an XSL pattern query.

Take a look at http://www.devguru.com/Technologies/xmldom/QuickRef/node_selectNodes.html and XML DOM Reference at http://www.devguru.com/technologies/XML_DOM/home.asp

One last question, this ActiveX component has to be in a rollout. But it creates a black rectangle on my rollout, not very pretty:). Is there a way to make it disappear ?

(I’ve tried

activeXControl xmlParser "Microsoft.XMLDOM" visible:false

this doesn’t work)

Hi,

Here is the way to do that :

rollout rXML "XML" silenterrors:true
( 
	local init = true
	activeXControl axXML "MSXML2.DOMDocument" setupEvents:false releaseOnClose:false
	on rXML open do init = false
)

struct _xmlops (

	xmlDoc,
	
	-- Init xmlDoc member
	fn init force:false =
	(
		if( rXML.init or force ) do
		(
			createDialog rXML
			destroyDialog rXML
		)
		
		-- Init member
		xmlDoc = rXML.axXML
		xmlDoc.async = false
	),
	
	-- Return xmlDoc member
	fn GetXmlDoc =
	(
		xmlDoc
	)
)

xmlops = _xmlops()

With this example the rollout containing the XMLDOM activex is destroyed at init but the control is not released on close.

Also look at :

Hey Charles,

You can destroy the rollout that houses the ActiveX control and it will still be accessible. We do this by putting our instances of the ActiveX control in a separate rollout and create/destroy it before we begin XML related functions.

-b

Hey Charles,

You can destroy the rollout that houses the ActiveX control and it will still be accessible. We do this by putting our instances of the ActiveX control in a separate rollout and create/destroy it before we begin XML related functions.

The source code I’ve posted does exactly what you’ve said :).

Page 1 / 2