source7.xml

来自「XML tutorial」· XML 代码 · 共 36 行

XML
36
字号
<XTutorial id="7" next="8" previous="6">
<description lang='eng'>An element can have none, one or several attributes. Permitted characters are the same as for element names. The name of attribute is separated from its value by =. The attribute value must be given inside apostrophes '...' or double-quotes  "..." . If an apostrophe or double-quote is used in the attribute value the opposite delimiter must be used.  </description>
<!-- <description lang='cze'>Element může mít žádný, jeden nebo několik atributů. Pro jejich názvy platí stejná pravidla jako pro názvy elementů. Jméno atributu je odděleno od jeho hodnoty rovnítkem = . Hodnota atributu musí být uvedena uvnitř apostrofů '...' nebo uvozovek "..." . Pokud jsou apostrofy nebo uvozovky použity v hodnotě  atributu, musí být použit opačný oddělovač. </description> -->
<description lang='chi'>元素可以没有, 有一个或者有多个属性, 属性名的命名规则同元素命名规则相同. 其名字和值由 = 分隔, 并且属性值必须在单引号 '...' 或者双引号 "..." 之间, 如果要在属性值里面使用单引号或双引号, 那么就必须使用反斜线来进行转义.</description>
<demo type="wf">
<description lang='eng'>Document with well formed attributes</description>
<!-- <description lang='cze'>Dokument se správně formátovanými atributy</description> -->
<description lang='chi'>格式正规的文档属性</description>
<doc>
{elements-with-attributes}
	{el _ok = "yes" /}
	{one attr = "a value"/}
	{several first="1" second = '2' third= "333"/}
	{apos_quote case1="John's" case2='He said: "Hello, world!"  '/}
{/elements-with-attributes}
</doc>

</demo>

<demo type="notwf">
<description lang='eng'>Document with erroneous attributes</description>
<!-- <description lang='cze'>Dokument s chybnými atributy</description> -->
<description lang='chi'>属性格式不正确的文档</description>
<doc>
{errors}
	{wrong_char a<error>*</error>b = "23432"/}
	{mismatched_separator value = <error>"</error>12<error>'</error>/}
	{wrong_separator_type  value="aa<error>"</error>aa"/}
	{wrong_separator_type  value='bb<error>'</error>bb'/}
	{wrong_start <error>XML</error>-ID = "xml234"/}
{/errors}
</doc>
</demo>

</XTutorial>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?