以XML格式存储HTML [英] Storing HTML in XML

查看:71
本文介绍了以XML格式存储HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我可以在HTML节点中存储HTML标签吗?我需要一些

方式来分享新闻头条。由于头条新闻不同,因此仅存储标题和

链接将非常困难。如果可能的话,我该怎么做?


Burnsy

Hi,

Is it possible for me to store HTML tags inside XML nodes? I need some
way to share news headlines. Because the headlines differ in their
presentsation, it would be very difficult to store simply the title and
link. If possible, how would I do this?

Burnsy

推荐答案

Tempore 14: 44:40,死于公元2005年8月10日星期三,hinc in foro {comp.text.xml} scripsit< bi ****** @ yahoo.co.uk>:
Tempore 14:44:40, die Wednesday 10 August 2005 AD, hinc in foro {comp.text.xml} scripsit <bi******@yahoo.co.uk>:
我可以在HTML节点中存储HTML标签吗?我需要一些分享新闻头条的方式。由于标题的呈现方式不同,因此仅存储标题和
链接将非常困难。如果可能的话,我该怎么做?
Is it possible for me to store HTML tags inside XML nodes? I need some
way to share news headlines. Because the headlines differ in their
presentsation, it would be very difficult to store simply the title and
link. If possible, how would I do this?



如果HTML格式正确,你可以将它视为X(HT)ML,并将节点视为xml文档


-

Joris Gillis( http://users.telenet.be/root-jg/me.html

Vincit omnia simplicitas

保持简单


If the HTML is well-formed, you can treat it as X(HT)ML and at the nodes to your xml document

--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Vincit omnia simplicitas
Keep it simple


bi******@yahoo.co.uk 写道:
bi******@yahoo.co.uk wrote:
我可以在HTML节点中存储HTML标签吗?


是的,但它并不漂亮。
http://diveintomark.org/archives/200...compatible-rss

我需要一些方法来分享新闻头条。
Is it possible for me to store HTML tags inside XML nodes?
Yes, but it''s not pretty.
http://diveintomark.org/archives/200...compatible-rss
I need some way to share news headlines.




然后使用RSS 1.0或Atom 1.0

这是一个现成的轮子。

< a rel =nofollowhref =http://xml.coverpages.org/ni2005-07-15-a.html\"target =_ blank> http://xml.coverpages.org/ni2005-07-15 -a.html



Then use RSS 1.0 or Atom 1.0
This is very much a ready-invented wheel.

http://xml.coverpages.org/ni2005-07-15-a.html


Joris Gillis写道:
Joris Gillis wrote:
如果HTML格式正确,你可以将它视为X(HT)ML
和节点到你的xml文件
If the HTML is well-formed, you can treat it as X(HT)ML
and at the nodes to your xml document




这是有问题的(不可行的,所以,在我的巨大经验做什么

吧。


- 它可能是片段,而不是整个HTML文档。


- 如果它是一个片段,那么它可能有多个根e lements,或者非

。你可以用XML来操作它,但你必须小心使用片段工具,而不是节点树。


- 如果它是HTML,你不能保证良好的形式。即便相当好b / b
表现良好的HTML可以省略结束标签,特别是如果它是从较大页面任意选择的




- HTML实体的问题没有用XML声明。


- 外部提供的HTML将有垃圾 - 一天。


- HTML不是XML。将XML规则应用于它,例如最小化没有内容的非空元素(例如< script src =" foo">< / script>)

可以导致下游无法解决问题。



This is problematic (unworkably so, in my enormous experience of doing
it).

- It''s probably a fragment, not a whole HTML document.

- If it is a fragment, then it may have multiple root elements, or non
at all. You can manipulate this in XML, but you have to be careful to
use fragment tools on it, not node trees.

- If it''s HTML, you just can''t guarantee well-formedness. Even quite
well-behaved HTML can omit closing tags, especially if it''s an
arbitrary selection from a larger page.

- There''s the issue of HTML entities that aren''t declared in XML.

- Externally supplied HTML will have garbage in it - one day.

- HTML isn''t XML. Applying XML rules to it, such as minimising a
non-empty element with no content (like <script src="foo" ></script> )
can cause no end of trouble downstream.


这篇关于以XML格式存储HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆