In this element the app logs anything it gets from foreign hosts.
Your problem is to map "input" to well-formed character data according
to the rules of
http://www.w3.org/TR/2004/REC-xml11-20040204/#syntax
This is a task as old as computer programming with input files. There
are several rechniques to solve it, broadly by "escaping" or by
"wrapping"
Your example of
<xmlLog><somTag></somTag></xmlLog>
is quite easy, and could indeed be stored and read back, then treated
as ASCII.
However a foreign host that sends "<notATag<><>>" will break things,
because
<xmlLog><notATag<><>></xmlLog>
isn't well-formed XML and so parsers will choke on it.
The main problem is to handle the mapping of arbitrary characters into
"character data" (this is a term carefully defined in the XML spec).
The "escaping" way to do this is quite simple, and can be done with a
handful of character substitutions (from the XML spec):
:>The ampersand character (&) and the left angle bracket (<) MUST NOT
:> appear in their literal form, [...] they MUST be escaped using
:> either numeric character references or the strings "&" and "<"
:> respectively. The right angle bracket (>) MAY be represented using
:> the string ">", and MUST, for compatibility, be escaped using
:> either ">" or a character reference when it appears in the string
:> "]]>" in content,
So your example of
<xmlLog><somTag></somTag></xmlLog>
becomes
<xmlLog><somTag></somTag></xmlLog>
You could also use a "CDATA section", which would be the "wrapping"
approach. This takes the dubious input content and places it between
two markers that say "Between these points is CDATA, not XML markup"
The markers are <![CDATA[ and ]]>
Your example of
<xmlLog><somTag></somTag></xmlLog>
becomes
<xmlLog><![CDATA[<somTag></somTag>]]></xmlLog>
be warned that you'll still need escaping in case the input contains a
copy of the end marker! (read the XML spec, or ask again)
Second problem is to define "input". This is important because in
today's world we're really having to face up to internationalization,
character sets and encodings. It's likely that you can redefine input
from "anything" to "anything that is in UTF-8", which will make your
life easier, but be aware you _have_ made a deliberate choice here.
It's OK to write code that breaks in Japanese - just be aware that
you've done so, and know what would need changing if you needed to
remedy this.
You'll find that RSS has this same problem when embedding HTML content
within it. Some RSS versions handle this better than others, and
there's an excellent overview here
http://diveintomark.org/archives/2004/02/04/incompatible-rss