#1 Problem when receive XML from Java

open
nobody
None
5
2004-05-12
2004-05-12
Anonymous
No

When XMLRCP.asp receives XML made from XMLRCP Java
it crash if encounter an empty string.

- My ASP made a "Scripting.Dictionary" object with many
items

- XMLRCP.asp made tags
<value><string></string></value> for each item in
this "Scripting.Dictionary"

- It sends this XML to a Java servlet

- The servlet converts this XML into a Hashtable

- Java converts the Hashtable into an XML with this
tags <value></value> for each item

- When XMLRCP.asp receives this XML and try to
convert to an object crash when encounter an empty
item <value></value>.

I solve this adding the next If into XMLToValue function
into XMLRCP.ASP

//**********
If( xmlNd.childNodes(0).childNodes(k).childNodes(1).text
<> "" ) then
val.Add xmlNd.childNodes(0).childNodes(k).childNodes
(0).text, _
XMLToValue(xmlNd.childNodes(0).childNodes
(k).childNodes(1))
Else
val.Add xmlNd.childNodes(0).childNodes(k).childNodes
(0).text, ""
End If
//**********

Without this code, function XMLToValue crash, when try
to execute the next line of code

//**********
if NOT xmlNd.childNodes(0).nodeType = 3 then
//**********

childNodes(0) don't exist into <value></value>

If Java will return into <value></value> tags an
<string></string> tag this problem don't occurs.

Discussion

  • Logged In: NO

    This Problem was submited by ivan.castro@allianz.es