question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

newline character at end of RawCoT causes issues

See original GitHub issue

I was working on a custom application where I was generating an XML CoT using QT’s QXmlStreamWriter. This Application runs on a Desktop and streams CoT messages to the server at a 2 second interval. Then I use an android tablet running ATAK to view the friendly contact’s position.

Using QT’s documentation ending the XML Stream with QXmlStreamWriter::writeEndDocument() (to close out the writeStartDocument()) adds a newline at the end of the XML.

On the server, the RawCoT.xmlString appears as:

[<?xml version="1.0" encoding="UTF-8" standalone="yes"?><event version="2.0" uid="MYCOT0" time="2021-08-25T00:15:32Z" start="2021-08-25T00:15:32Z" stale="2021-08-25T00:16:32Z" how="m-g" type="a-f-A"><point lat="34.0" lon="-118.0" hae="50" ce="9999999.0" le="9999999.0"/><detail><contact endpoint="*:-1:stcp" callsign="MYCOT"/><precisionlocation altsrc="GPS" geopointsrc="GPS"/><__group role="Team Member" name="Cyan"/><takv os="1" platform="qgc" version="1.0"/></detail></event>
]

This CoT then doesn’t update correctly on the clients. It stays in one position and bounces if the lat/lon changes.

Removing the QXmlStreamWriter::writeEndDocument() results in

[<?xml version="1.0" encoding="UTF-8" standalone="yes"?><event version="2.0" uid="MYCOT0" time="2021-08-25T00:15:32Z" start="2021-08-25T00:15:32Z" stale="2021-08-25T00:16:32Z" how="m-g" type="a-f-A"><point lat="34.0" lon="-118.0" hae="50" ce="9999999.0" le="9999999.0"/><detail><contact endpoint="*:-1:stcp" callsign="MYCOT"/><precisionlocation altsrc="GPS" geopointsrc="GPS"/><__group role="Team Member" name="Cyan"/><takv os="1" platform="qgc" version="1.0"/></detail></event>]

With no newline at the end. This CoT message updates on my android ATAK client and everything looks correct.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
guitarpicvacommented, Sep 11, 2021

Have a look in the source for Atak in commoncommo

https://github.com/deptofdefense/AndroidTacticalAssaultKit-CIV/blob/master/commoncommo/core/impl/protobuf/protocol.txt

I think you’ll see the expected format of the XML in that file.

0reactions
brothercorvocommented, Dec 11, 2021

We do not suggest to use the XML for integration. use the REST API

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is a newline being added at the end of my strings?
I noticed that, for some reason, when I use the + symbol when joining two variables, Python automatically uses a newline.
Read more >
What's the point in adding a new line to the end of a file?
If a file ends without a newline character, then adding anything to ... This could cause unwanted results with commands such as git...
Read more >
Protect Yourself Against Line Ending Issues when Using ...
In computing, a newline, also known as a line ending, end of line (EOL), or line break, is a special character or sequence...
Read more >
EOL or End of Line or newline ascii character
What is an End of Line character: It is a character in a string which represents a line break, which means that after...
Read more >
Newline - Wikipedia
Newline (frequently called line ending, end of line (EOL), next line (NEL) or line break) is a control character or sequence of control...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found