Debugging XML?
BobbyV
Posts: 19
Hello All,
I'v got a question for all the machine control experts out there!
I'm trying to get the propeller to talk to a piece of equipment over a standard serial interface (9600bps, 8bits, no parity, 1 stop bit) and in the manual it states that....
"The configuration grammar used to communicate with the LI-840A is based upon a subset of
the eXtensible Markup Language (XML). XML relies on the use of tags to "Markup", or give
structural rules to a set of data."
a provided example command to query for a sample of data is:
<LI840><CFG>?</CFG></LI840>
So to send this via the propeller using FullDuplexSerial I would just use a command like this:
debug.str(string("<LI840><CFG>?</CFG></LI840>"))
Correct?
The reason I'm asking this is because when did a good ol' google search on XML to serial or to "serialize XML" all I found was a bunch of really long looking C scripts to do something that I initially thought would only require one line of code! Having dealt with the frustration of getting one machine to talk to another for the first time before, I figured I would go ahead and ask now before I end up elbows deep in coffee and gummy bears!
Thanks!
I'v got a question for all the machine control experts out there!
I'm trying to get the propeller to talk to a piece of equipment over a standard serial interface (9600bps, 8bits, no parity, 1 stop bit) and in the manual it states that....
"The configuration grammar used to communicate with the LI-840A is based upon a subset of
the eXtensible Markup Language (XML). XML relies on the use of tags to "Markup", or give
structural rules to a set of data."
a provided example command to query for a sample of data is:
<LI840><CFG>?</CFG></LI840>
So to send this via the propeller using FullDuplexSerial I would just use a command like this:
debug.str(string("<LI840><CFG>?</CFG></LI840>"))
Correct?
The reason I'm asking this is because when did a good ol' google search on XML to serial or to "serialize XML" all I found was a bunch of really long looking C scripts to do something that I initially thought would only require one line of code! Having dealt with the frustration of getting one machine to talk to another for the first time before, I figured I would go ahead and ask now before I end up elbows deep in coffee and gummy bears!
Thanks!
Comments
I guess there is a bunch of other tags for different data items you can set or query in the device.
More tricky might be the translation of the returned xml into data values. As you have to parse those tags to see what you have got.
I guess searching for "serializing xml" or such does not turn up much because the XML is already serial, just a bunch of characters in a string. What really happens is that your data structures get serialized to XML and XML gets deserialized into your data structure. Often producing what is call the Document Object Model, DOM, in memory.
Hopefuly your case will be quite simple. Just send some likely looking commands to your gadget and see how and it answers.
I think you are on the right track.