Exporting multiline text to xml

The below text is kinda xml but the data in the value should be displayed:
This multiline text isn’t formatted properly.
<Private_0x2001_0x10F2 group=“2001” element=“10F2” vr=“FL” Size=“24”>

9E C9 FF 7E 9E C9 FF 7E 9E C9 FF 7E 9E C9 FF 7E :~~~~:
9E C9 FF 7E 9E C9 FF 7E :~~:

</Private_0x2001_0x10F2>

Suggestions? (Ultimately the data is to be displayed in a html viewer.)

Who created the data?
whitespace in XML is more or less ignored.
You can include special characters by wrapping in a [[CDATA ]] construct
Or you can add control characters such as #&D; (if memory serves)

eg

<Private_0x2001_0x10F2 group=“2001” element=“10F2” vr=“FL” Size=“24”>
9E C9 FF 7E 9E C9 FF 7E 9E C9 FF 7E 9E C9 FF 7E :***~*** ~***~*** ~:#&D; 
9E C9 FF 7E 9E C9 FF 7E :***~*** ~:#&D; 
</Private_0x2001_0x10F2>

If it wasnt you, then you may need to create rules like adding a carriage return when you encounter ~:

I created it from a object… which has a tree like structure.
The values are ‘leaf’ nodes.
I probably should have used Baase64 Encoding but that is illegible. The Intel hex format is what I want as a value but it has spaces, tabs and carriage return line feeds.

I think CDATA is a solution as and perhaps #x9 #xD #xA
Did you purposly leave out the value child @Jeff_Tullin ?

From the w3c tutorial…

<script>
   <![CDATA[
      <message> Welcome to TutorialsPoint </message>
   ]] >
</script >   

Which i interpret to mean that this should work. Must I use #x9, #xD #xA? if they appear in the hex output?

 <Private_0x2001_0x10F2 group="2001" element="10F2" vr="FL" Size="24">
    	<![CDATA[<value>
    		9E C9 FF 7E 9E C9 FF 7E 9E C9 FF 7E 9E C9 FF 7E 	:___~___~___~___~:
    		9E C9 FF 7E 9E C9 FF 7E                         	:___~___~:
    	</value>]]>
    </Private_0x2001_0x10F2>

Copied yours, added a couple of codes.
‘Value child’?
Quick answer, no I didnt purposely leave something out. Just quickly typed. :slight_smile: