如何在DocBook V5.0中使用RELAX NG模式创建新实体

时间:2016-05-03 01:46:54

标签: dtd docbook xml-dtd relaxng docbook-5

使用DocBook V4.x和DTD,我可以创建一个实体:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [

<!ENTITY mdash   "&#8212;">

]>
<article>
...
<title>Em dash</title>

<para>The em dash is perhaps the most versatile punctuation mark.
Depending on the context, the em dash can take the place of commas,
parentheses, or colons&mdash;in each case to slightly different effect.</para>
...
</article>

如何使用RELAX NG架构对DocBook V5.0做同样的事情?:

<?xml version='1.0' encoding='utf-8'?>
<article xmlns='http://docbook.org/ns/docbook' version='5.0' xml:lang='en'>
...
<title>Em dash</title>
<para>The em dash is perhaps the most versatile punctuation mark.
Depending on the context, the em dash can take the place of commas,
parentheses, or colons&mdash;in each case to slightly different effect.</para>

1 个答案:

答案 0 :(得分:3)

您无法使用RELAX NG定义常规实体。实体是DTD的东西。您需要使用内部DTD子集(如第一个代码示例中所示),或者只使用硬编码的工具来识别实体(例如,作为Web浏览器)。