View Full Version : Can I embed XML in HTML??
shachi
12-19-2006, 06:25 PM
Can anyone tell me if one can embed xml in (x)*html ?
Thanks.
"Embed" how? What do you expect this XML to do? XML is just a data format, it can't do anything without a parser.
shachi
12-19-2006, 06:31 PM
Ok, thanks. I just wanted to know if I could or not. Thanks again.
Certainly you can display XML in HTML, and you can even use profiles of it for various things (VML in IE, or MathML in an XHTML-supporting browser).
mwinter
12-19-2006, 06:54 PM
Certainly you can display XML in HTML ...
Yes, though it's not valid to include an XML document fragment as markup within a HTML document.
Mike
shachi
12-19-2006, 06:59 PM
Twey: So how can I do that?
mwinter: Isn't there any way we can make it valid?
mwinter
12-19-2006, 07:08 PM
Isn't there any way we can make it valid?
A HTML document can only contain HTML and character data (text in elements, including embedded style sheets and scripts).
An XML document can be used by parts of a HTML document, such as frames, object elements, and within scripts, but the former cannot be directly contained within the latter. It may be possible to transform the XML document into a HTML fragment, but then it isn't XML any more.
Mike
shachi
12-19-2006, 07:15 PM
mwinter: Thanks you for explaining. How can scripts embed them?
mwinter
12-19-2006, 07:35 PM
How can scripts embed them?
A script can't, but with support for objects like XMLHttpRequest and DOMDocument, an XML document can loaded and queried using DOM methods.
Mike
shachi
12-19-2006, 07:40 PM
Oh, sorry, I misunderstood.
bukti
10-25-2008, 06:55 AM
It is possible to embed XML within HTML. As mentioned, it will not be XML anymore but more "custom" tags.
One method is to run PHP, that initiates an XSLT processor, load the XSL and XML as DomDocuments, transform the data then return it.
However a bit of tweaking for the Apache server is necessary, such as telling it to read HTML as well as XML.
i.e
AddType application/x-httpd-php .php .html
and remove # from "LoadModule rewrite_module modules/mod_rewrite.so"
and AllowOverride All
are some of the changes you will need to make
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.