beautypg.com

Parsing a lonbridge xml message – Echelon LonBridg Server User Manual

Page 32

background image

26

LonBridge API

Examples:
Error deleting non-existing object:





...





...


More complex error reporting:





...

code="6">



...




Parsing a LonBridge XML Message

To parse a LonBridge XML message, a LonBridge application can use a XML

parser or a custom parsing routine. For example, you could base a parsing
routine on the following ECMAScript function:

function parse_node(name) {
p = name.split('.');
if (p.length > 4) {
return null;
}
var properties = new Array("domain", "client", "object",
"method");
o = {domain: null, client: null, method: null,
object: null};
posProperty = 3;
for(i = p.length - 1; i >= 0; i--) {
o[properties[posProperty]] =
p[i] != null && p[i].length > 0) p[i] : null;