Getting around IDE not Logging XML responses


(Patrick Stuart [@pstuart]) #1

All,

Found a simple way to log an XML response to an attribute, since log.debug will not return anything when the value is XML.

Create an attribute in a device type. Do a sendEvent to that attribute, value is the xml. Pull up the devices tab and view the response in its xml glory.

For a smartapp, just set a state var and view it in the locations, smartapp state vars section.

Why the IDE won’t log xml is beyond me. But these 2 workaround help a great deal in parsing it.

Of course, the other option is to loop through each key, value and log the data, but this much more difficult.

Someday, the IDE will work correctly… Someday… I’m just glad it works, mostly.


(Yogesh Mhatre) #2

Im in midst of banging my head during XML parsing. Could you please elaborate on your second workaround.

Thanks


(Patrick Stuart [@pstuart]) #3

Instead of log.debug (xml response here) which returns null (or empty string in logger)

Do this:

state.xml = (xml response here)

and then go into the locations section of the IDE, down to smartapps, click the smartapp you are trying to debug and you will see the state variables, xml and that will have the entire xml response there.