xml - 我可以将 xml 嵌入到 html 中吗?

标签 xml

我有动态内容,其高度会增长和缩小,需要嵌入到我们不托管或无法控制的其他网站中。我使用 iframe 来做到这一点,但在意识到动态更改 iframe 的高度基本上是不可能的之后,我开始考虑使用 xml。我唯一的要求是容器必须随着导入的数据而增长和收缩。

我可以为此使用 xml 吗?页面加载时我将使用什么标签来获取数据?当页面加载时,数据需要准备好显示。

最佳答案

根据OP的要求复制pasta:

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.

关于xml - 我可以将 xml 嵌入到 html 中吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5890973/

相关文章:

Java - 读取 XML 并保留所有实体

php - 从内联二进制附件创建 zip 到多部分消息

Java jdom xml解析

Java XML 解码在使用 JAXB 的符号 (&) 上失败

c - C 的最佳 XML 解析器

java - 是什么导致 RecyclerView 中的滚动性能不佳?

java - 如何从不同于 init() 的类调用缓存的 xsl 模板

c# - 在两个项目之间共享 XML 文件?

c# - XMLReader读取属性

javascript - 我如何从包含 CDATA 和 xml 的节点中读取单个 xml 节点