Re: HTML in XML???
| From: | Brian White | Date: | Wed, 18 Jul 2001 22:04:06 +0000 |
| Subject: | Re: HTML in XML??? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-58575@lists.php.net to get a copy of this message | ||
At 14:10 18/07/2001 +0000, Leon wrote:
Hi, Is there some way to include HTML tags in a XML doc??? I want to use a XML document to include HTML data for my webpage. I have made a solution of replacing a special word to the '<' and '>" of a HTML tag. But I think my solution is very stupid.How you do this does in depends on your requirements. Is this blob of HTML data something you need to be able to parse into and analyse, or is only ever going to be used as a single unit? In that case your solution is probably the best one, except I would make sure you use the standard mappings for this which are
"<" ==> "<"
">" ==> ">"
pre-existing "&" ==> "&"
as any XML tool worth it's salt will provide a simple way to do
this transformation. The php function for encoding a lump of
text in this way is "htmlspecialchars", and I suspect the XML
parser will autonmatically decode it for you.
If this is a blob of data you need to be able to analyse then
is not HTML any more, so much as an integral part of the
structure of your document that has certain similarities with
HTML. If you are using a DTD, I would figure out what HTML
you actually need and define a subset of allowable elements
and use those.
If you are using merely well formed XML, then you can slot in whatever
you like, as long as
a) You have it wrapped up in a element name liked "<htmlexcerpt>"
b) Your HTML is XHTML
However, I personally thing not having a DTD give you no discipline,
structure or specification and is a bad idea.
And is there a special php xml newsgroup?? thanks, Leon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net------------------------- Brian White Step Two Designs Pty Ltd - SGML, XML & HTML Consultancy Phone: +612-93197901 Web: http://www.steptwo.com.au/ Email: bwhite@steptwo.com.au