Alternative to CDATA and [ ] for line breaks

554 views
Skip to first unread message

PMOlsen

unread,
Jan 10, 2006, 5:02:07 PM1/10/06
to KML Discussions
I am generating a KML file on an IBM (EBCDIC) mainframe based on mainframe data and transmitting it to the PC. Problem is EBCDIC does not have [ and ] and/or the translation from EBCDIC to ASCII does not translate them properly. Is there any alternative to CDATA and the square brackets to achieve line breaks in the description for a placemark, instead of using the CDATA for <br>

Here is what I want:

Name
Address 1
Address 2
blank line
Detail 1
Detail 2
...

HookEmHorns

unread,
Jan 10, 2006, 5:40:12 PM1/10/06
to KML Discussions
Maybe, but I don't know off the top of my head....

What does the text come over looking like? Maybe you could just have a little frontend program that just does a find and replace of:

<description><!CDATA --> <description><!CDATA[

></description> --> ]]></description>

Or maybe you could just send the raw data to the PC and use your KML generating code on the PC end?

With the find and replace... actually, it might be smarter to use a sequence of characters that are not and never will be used in KML for "[" and "]" and then do a global find and replace on the PC end. For instance, maybe "LeftBracketLeft" gets mapped into "[", and "RightBracketRight" gets mapped into "]". Obviously that might not be the best choice, but you get the suggestion at least, so your EBCDIC code comes to the PC looking like:

"<!LeftBracketLeftCDATALeftBracketLeft"

and the frontend fixes it.

PMOlsen

unread,
Jan 10, 2006, 6:45:55 PM1/10/06
to KML Discussions
Thanks for the suggestion but that is what I was doing. But it is something for end users to use hopefully without any intervention. I have also found that I can make it work properly by encoding the data in hex on the IBM end. But I would still like to know if there is any alternative to CDATA.

xav

unread,
Jan 11, 2006, 11:33:32 PM1/11/06
to KML Discussions
You don't need the CDATA and square brackets if you escape the angle brackets inside the description.
Use &gt; for < and &lt; for<.

so you could write:
Code:
  
<description>
name&lt;br&gt;
street&lt;br&gt;
line3&lt;br&gt;&lt;br&gt;
line5
</description>


hope this helps

xav
Reply all
Reply to author
Forward
0 new messages