jim
jim

Reputation: 23

Can I embed xml into html?

I have dynamic content that will grow and shrink in height that needs to be embedded into other sites that we do not host or have any control over. I was using an iframe to do this but after realizing that it is basically impossible to dynamically change the height of an iframe I started thinking about using xml. The only requirement I have is that the container MUST grow and shrink with the data being imported.

Can I use xml for this? What tag would I use to grab the data when the page loads? When the page loads, the data would need to be ready to show.

Upvotes: 2

Views: 5796

Answers (2)

Michael Kay
Michael Kay

Reputation: 163302

See section 2.4 of

http://www.w3.org/2010/html-xml/snapshot/report.html#uc04

which talks about "adding islands of more richly structured XML markup to existing HTML5 documents."

Upvotes: 2

Matt Ball
Matt Ball

Reputation: 359786

Copypasta'd at OP's request:

You can embed XML into HTML (using a <pre> tag), but how would you expect it to render beyond showing the raw XML text? I also don't see how XML has anything to do with the height of your "dynamic" content. What do you mean by "dynamic content," anyway?

While you can associate stylesheets with XML documents that really just doesn't sound like the right approach. Your problem is entirely CSS-related. You just want to be able to change the height of an iframe, right?

I think that the best you'll be able to do is provide a little bit of JavaScript along with the iframe. An iframe is definitely the way to go when it comes to providing a component to be embedded in an arbitrary page, but that means the iframe is at the mercy of the parent page w/r/t placement, dimensions, etc.

Upvotes: 3

Related Questions