Results 1 to 3 of 3

Thread: Simple Question in XML

  1. #1

    Thread Starter
    Hyperactive Member jeba's Avatar
    Join Date
    Feb 2000
    Posts
    265

    Simple Question in XML

    Hi there!
    In XML file, how do I check if a particular element exists or not in ASP (Vbscript)?
    I have used this:

    Code:
    	set elmt=objXML.selectSingleNode(elmntname)	'elmntname is passed as a parameter
    I have checked for IsNull(elmt), which always returns True, even if there is a node.

    Also I have used the following code to check,

    Code:
    	if elmt is nothing then
    		Response.write "Node not found!"
    	else
    		Response.write "Node found!"
    	end if
    But, this gives the "Node not found!" message, even if there is one in the file.
    Please help me.
    J£ßä

  2. #2
    Lively Member harsoni's Avatar
    Join Date
    Oct 2000
    Posts
    118
    if len(objXML.documentElement.getElementsByTagName('ERROR')) <> 0 then
    Tag is present
    else
    Tag is not present

    End if

    I hope this pice of code works for u...

    Sonia

  3. #3
    Lively Member harsoni's Avatar
    Join Date
    Oct 2000
    Posts
    118
    if len(objXML.documentElement.getElementsByTagName(elmntname)) <> 0 then


    use this
    Sonia

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width