如何将XUL插入XHTML文档

时间:2020-12-18 23:30:44

I have a XHTML document and want to embed XUL widgets into the document. What is the correct XML syntax to do so?

我有一个XHTML文档,并希望将XUL小部件嵌入到文档中。这样做的正确XML语法是什么?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>  
</head>
  <body>    
  insert XUL here
  </body>
</html>

1 个解决方案

#1


10  

add xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" to your <html> tag.

将xmlns:xul =“http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul”添加到标记中。

then use <xul:element>, e.g. <xul:vbox>

然后使用 ,例如 :vbox> :element>

Edit

编辑

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
      xml:lang="en" lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>  
</head>
  <body>    
    <xul:vbox>
    </xul:vbox>
  </body>
</html>

Also, I assume this isn't such a simple case... otherwise there wouldn't be much point in wrapping the xul in html (though the other way around does happen sometimes)

另外,我认为这不是一个简单的例子......否则在html中包装xul没有多大意义(尽管有时会发生相反的情况)

Edit

编辑

Some additional points to keep in mind when doing this:

这样做时要记住一些额外的要点:

  1. must be served with a valid xml type. e.g. application/xml or text/xml -- not text/html. (See https://bugzilla.mozilla.org/show_bug.cgi?id=101147#c12 -- the whole thread is worth a read)
  2. 必须使用有效的xml类型。例如application / xml或text / xml - 不是text / html。 (参见https://bugzilla.mozilla.org/show_bug.cgi?id=101147#c12 - 整个帖子值得一读)
  3. must be valid xml. A certain degree of sloppiness is tolerated by browsers when parsing html (unclosed tags, etc.) and this is not that case for a document containing xul (even the html parts of the document)
  4. 必须是有效的xml。在解析html(未封闭的标签等)时,浏览器会容忍一定程度的邋iness,而对于包含xul的文档(即使是文档的html部分)也不是这种情况

(thanks to Nikolay for the first point)

(感谢尼古拉的第一点)

#1


10  

add xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" to your <html> tag.

将xmlns:xul =“http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul”添加到标记中。

then use <xul:element>, e.g. <xul:vbox>

然后使用 ,例如 :vbox> :element>

Edit

编辑

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
      xml:lang="en" lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>  
</head>
  <body>    
    <xul:vbox>
    </xul:vbox>
  </body>
</html>

Also, I assume this isn't such a simple case... otherwise there wouldn't be much point in wrapping the xul in html (though the other way around does happen sometimes)

另外,我认为这不是一个简单的例子......否则在html中包装xul没有多大意义(尽管有时会发生相反的情况)

Edit

编辑

Some additional points to keep in mind when doing this:

这样做时要记住一些额外的要点:

  1. must be served with a valid xml type. e.g. application/xml or text/xml -- not text/html. (See https://bugzilla.mozilla.org/show_bug.cgi?id=101147#c12 -- the whole thread is worth a read)
  2. 必须使用有效的xml类型。例如application / xml或text / xml - 不是text / html。 (参见https://bugzilla.mozilla.org/show_bug.cgi?id=101147#c12 - 整个帖子值得一读)
  3. must be valid xml. A certain degree of sloppiness is tolerated by browsers when parsing html (unclosed tags, etc.) and this is not that case for a document containing xul (even the html parts of the document)
  4. 必须是有效的xml。在解析html(未封闭的标签等)时,浏览器会容忍一定程度的邋iness,而对于包含xul的文档(即使是文档的html部分)也不是这种情况

(thanks to Nikolay for the first point)

(感谢尼古拉的第一点)