Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: how to check for empty nodw ?

From: shafiqrao@-----.---
To: NULL
Date: 5/2/2006 2:19:00 PM

Thanks for the reply Martin, Here is the ASP file, which includes the
XML string ... does this make sence now ?? I want to validate that
employee_id should never be empty ... I was not able to implment that
simple check I feel myself so dumb :(


<%
Response.ContentType = "text/xml"
dim tag_indicator
tag_indicator = False
dim Status_Message
Status_Message = "ok"
Error_Message = "None"

XMLString =
"<data><version>1.0</version><employee><employee_id></employee_id><comments>free
text</comments></employee></data>"
'XMLString = Request("xml")
dim objList
Set objList = CreateObject("Microsoft.XMLDOM")
objlist.async = true
objList.validateOnParse = true
objList.loadxml(XMLString)

TraverseTree(objList.documentElement)

Sub TraverseTree(obj)
  For i = 0 to (obj.childNodes.length -1)
    if obj.childNodes.item(i).nodeName <> "#text" then
      set node = obj.childNodes.item(i)
      TraverseTree(node)
   else
      if (obj.childNodes.item(i).parentNode.nodeName = "employee_id")
Then
        Error_Message = "Employee ID should NOT be empty"
        Status_Message = "Not Okay"
      end if
   end if
   tag_indicator = False
   next
end Sub

Response_String = "<results><status>" & Status_Message &
"</status><error>" & Error_Message & "</error><data_sent>" & XMLString
&"</data_sent></results>"
Response.Write Response_String
%>



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent