Read data from file, send via HTTP form

J

jim.omalley

I'm trying to write an interface to send scoreboard data from an XML
file generated by a football stats program to a Chyron CODi character
generator connected to my COM1 serial port (all operations on same
machine). I'm already able to send static commands written into HTTP
forms to control the CG via serial COM1.

What I'm needing is a way to read and parse variables from the XML,
then generate a CODi command string which can be written to the page as
the value of a hidden form INPUT attribute.

Some of the XML variables are free standing and require no parsing, but
the stats program writes <downtogo context="V,1,10,H10"> to represent
"possFlag,down,togo,ballOn".

"possFlag" will have to be logically parsed (if possFlag = "V" then
vPoss = "1", hPoss = ""; if possFlag = "H" then hPoss = "1", vPoss =
""), "down" will have to be parsed into an ordinal ("1st", "2nd",
"3rd", 4th", 5="OT") and "togo" simply has to be extracted 'as-is'.

For reference, CODi command string syntax for this display is:

\DB\2\R\022\230\230\230\0\032\230\230\230\0\\\TU\1\Fox14\2\"vID"
"vPoss"\3\"vScore"\4\"hID" "hPoss"\5\"hScore"\6\"qtr"st Qtr\7\"down" &
"togo"\\

Since I'm not sending clock data to the CG on a realtime basis, I can
refresh the page after each play and send the CG command manually.

Although I've been playing with javascripts for more than 7 years, I
still consider myself a beginner. Thanks in advance for any help you
can offer.

Jim O'Malley / Station Manager / Fox14 Amarillo
 
M

mens libertina

What I'm needing is a way to read and parse variables from the XML,
then generate a CODi command string which can be written to the page as
the value of a hidden form INPUT attribute.


Well, you will have a lot of switch statements and concatenation.
Other than that, you will just have hours of testing / debugging.
There doesn't seem to be any special trick, just a lot of string
comparisons. For more powerful comparisons, look up replace() and
regular expressions.

How much are you willing to pay for it? ;)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top