[XML-SIG] Ignoring '<' and '>' in SGML

Marc van Grootel bwaumg@urc.tue.nl
Mon, 05 Oct 1998 11:26:31 +0200


> Hi,
> I have found a way of ignoring the '<' and '>' in HTML, and it just printd
> them out, rather than interpreting them as tags.
> I was wondering if this could be done in some way in SGML as I want to put
> in some sample code, that it should just display without giving me errors
> and telling me they are not tags ...
> Thanks,
> Eklav
> 

in SGML you can declare an element having CDATA content:

<!ELEMENT foo - - CDATA>

However this is not a solution for putting markup inside it since
the parser will still look for '</' which will end the foo element.

The safest you can do is put the part that has markup that you
don't want handled by the parser inside a marked section like so:

<tag-with-html-inside><![CDATA[
<pre>
  this will be left alone by 
  the parser
</pre>
]]></tag-with-html-inside>

This should work for XML and SGML.

Of course you could also encode the markup with &lt;foo&gt; etc.

Marc

--
Marc van Grootel
bwaumg@urc.tue.nl