I am trying to implement a protocol which I will use for my application to communicate with a server. The problem is that the server is using XML so I tried to send a string to the server containing xml but I get only errors.
When I send this :
mymsg: String = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'+
'<m:outgoingEngineMessage xmlns:c="http://www.bvb.ro/xml/ns/arena/gw/constraints"'+
'xmlns:m="http://www.bvb.ro/xml/ns/arena/gw/msg"'+
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'+
'<content xsi:type="HeartBeatcmd">'+
'</content>'+
'<csq>100212</csq>'+
'</m:outgoingEngineMessage>';
I receive an error saying:
Element type "m:outgoingEngineMessage" must be followed by either attribute specifications, "> ;" or "/> ;"
When I send this:
mymsg : String = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'+
'<m:outgoingEngineMessage xmlns:c="http://www.bvb.ro/xml/ns/arena/gw/constraints"'+
'xmlns:m="http://www.bvb.ro/xml/ns/arena/gw/msg"'+
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'+
'<content xsi:type="HeartBeatcmd">'+
'</content>'+
'<csq>100212</csq>'+
'</m:outgoingEngineMessage>'
I get: Element not allowed in prolog...
Can some one enlighten me what I am doing wrong? I have never worked with xml files before. Is there a function to convert xml to utf8 correctly? please explain.
xmlns:xsi="...and notxmlns:xsi="..., and other obvious differences like a closing</whatever>tag for the root element. In your example, the terminating</m:outgoingEngineMessage>is missing.