|
-
August 22nd, 2006, 12:40 PM
#1
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
-
August 22nd, 2006, 03:53 PM
#2
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
-
August 22nd, 2006, 04:27 PM
#3
Re: MSXML2.DOMDocument30 and xml
-
August 22nd, 2006, 09:15 PM
#4
Re: MSXML2.DOMDocument30 and xml
 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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|