MSXML2.DOMDocument30 and xml
i am parsing an XML using MSXML2.DOMDocument40
(almost everything is written)
but i look for a way how can i check if a certain node dosent exist
when i try to access by "getElementsByTagName" like this :
PHP Code:
objXMLDOM.getElementsByTagName("xxx")
how can i check if a node exist or not so i wont get an error ?
thnaks in advance
peleg
Re: MSXML2.DOMDocument30 and xml
Since getElementsByTagName returns a list of nodes, simply check for the length property this way:
Code:
Dim xNodeList As IXMLDOMNodeList
Set xNodeList = xDoc.getElementsByTagName("MyNode") 'returns list of nodes with this name
MsgBox xNodeList.length '0 if no matches
where xDoc is your MSXML.DOMDocument variable.
Check out this URL for more info, that's where I'm learning MSXML basics.
http://www.thescarms.com/XML/DOMTutorial.asp
Re: MSXML2.DOMDocument30 and xml
Re: MSXML2.DOMDocument30 and xml
Quote:
Originally Posted by dglienna
Actually that's for HTML only... the XML section at MSDN can be found here:
http://msdn.microsoft.com/library/de...aa453bfde1.asp