Из Википедии, бесплатной энциклопедии
Перейти к навигации Перейти к поиску

В документах SGML, HTML и XML логические конструкции, известные как символьные данные и значения атрибутов, состоят из последовательностей символов, в которых каждый символ может проявляться напрямую (представлять себя) или может быть представлен серией символов, называемой ссылкой на символ , из которых есть два типа: числовая символьная ссылка и символьная ссылка на сущность . В этой статье перечислены ссылки на символьные сущности, действительные в документах HTML и XML.

Ссылка на символьный объект относится к содержимому именованного объекта. Объявление сущности создается с использованием <!ENTITY name "value">синтаксиса определения типа документа (DTD).

Обзор ссылок на персонажей [ править ]

Цифровая ссылка на символ относится к символу , по его универсальному набору символов / Unicode точки коды , и использует формат:

&#nnnn;

или же

&#xхххх;

где nnnn - это кодовая точка в десятичной форме, а hhhh - это кодовая точка в шестнадцатеричной форме. В XML-документах x должен быть в нижнем регистре. Нннн или хххх может быть любое количество цифр и может включать в себя ведущие нули. В hhhh могут смешиваться прописные и строчные буквы, хотя прописные буквы являются обычным стилем.

Напротив, ссылка на символьный объект ссылается на символ по имени объекта, который имеет желаемый символ в качестве замещающего текста . Сущность должна быть либо предопределена (встроена в язык разметки), либо явно объявлена ​​в определении типа документа (DTD). Формат такой же, как и для любой ссылки на сущность:

&имя;

где name - имя объекта с учетом регистра. Точка с запятой является обязательной, если иное не указано в таблице ниже (см. [ A ] ).

Стандартные общедоступные наборы сущностей для персонажей [ править ]

Наборы объектов ISO : SGML предоставил исчерпывающий набор объявлений объектов для символов, широко используемых в западной технической и справочной публикации, для латинских, греческих и кириллических шрифтов. Американское математическое общество также способствовало объектам для математических символов.

Наборы сущностей HTML : Ранние версии HTML, состоящие из небольших подмножеств, относящихся к символам трех западных 8-битных шрифтов.

Наборы сущностей MathML : W3C разработал набор объявлений сущностей для символов MathML .

Наборы сущностей XML : Рабочая группа W3C MathML взяла на себя обслуживание наборов общедоступных сущностей ISO в сочетании с MathML и документировала их в определениях сущностей XML для символов . Этот набор может поддерживать требования XHTML , MathML и в качестве входных данных для будущих версий HTML.

HTML 5 : HTML5 принимает объекты XML как ссылки на именованные символы , однако повторно формулирует их без ссылки на их источники и не группирует их в наборы. Спецификация HTML 5 дополнительно предоставляет сопоставления имен с последовательностями символов Unicode с использованием JSON .

Многие другие наборы сущностей были разработаны для особых требований, а также для основных и дополнительных скриптов. Однако появление Unicode в значительной степени вытеснило их.

Предопределенные сущности в XML [ править ]

В спецификации XML не используются термины «символьная сущность» или «ссылка на символьную сущность». Спецификация XML определяет пять «предопределенных сущностей», представляющих специальные символы, и требует, чтобы все процессоры XML соблюдали их. Сущности также могут быть явно объявлены в DTD, но если это сделано, текст замены должен быть таким же, как и встроенные определения. XML также позволяет определять другие именованные объекты любого размера для каждого документа.

В таблице ниже перечислены пять предопределенных объектов XML. В начальном столбце «Имя» упоминается имя сущности. В столбце «Персонаж» отображается персонаж. Для визуализации символа используется формат &name;; например, &amp;отображается как &. Столбец «Кодовая точка Unicode» цитирует символ через стандартную нотацию UCS / Unicode «U +», которая показывает кодовую точку символа в шестнадцатеричном формате. Затем в скобках отображается десятичный эквивалент кодовой точки. Столбец «Стандартный» указывает первую версию XML, которая включает объект. Последний столбец «Имя» цитирует символ через его каноническое имя в UCS / Unicode.

Ссылки на символьные сущности в HTML [ править ]

DTD HTML 5 определяют множество именованных сущностей, ссылки на которые действуют как мнемонические псевдонимы для определенных символов Unicode. [1] Спецификация HTML 5 требует использования стандартных DTD и не позволяет пользователям определять дополнительные объекты.

В таблице ниже столбец «Стандартный» указывает первую версию HTML DTD, которая определяет ссылку на символьный объект. Чтобы использовать одну из этих символьных ссылок на сущности в документе HTML или XML, введите амперсанд, за которым следует имя сущности и точка с запятой , например, введите &copy;для символа авторского права (©).

Либо введите амперсанд , затем знак числа , число и точку с запятой . Например, чтобы отобразить символ авторского права ©, введите &#169;(при использовании этого метода используйте десятичные числа в скобках в третьем столбце). Точно так же вы можете ввести амперсанд , за которым следует знак числа , буква x , шестнадцатеричное число и точка с запятой . Например, чтобы отобразить символ авторского права ©, введите &#x00A9;или &#xA9;. (При использовании этого метода используйте шестнадцатеричные числа в третьем столбце без префикса U+.)

Notes[edit]

  1. ^ a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab ac ad ae af ag ah ai aj ak al am an ao ap aq ar as at au av aw ax ay az ba bb bc bd be bf bg bh bi bj bk bl bm bn bo bp bq br bs bt bu bv bw bx by bz ca cb cc cd ce cf cg ch ci cj ck cl cm cn co cp cq cr cs ct cu cv cw cx cy cz da db dc The trailing semicolon may be omitted for this named entity.
  2. ^ DTD: the full public DTD name (where the character entity name is defined) is actually mapped from one of the following three defined named entities:
    • HTMLlat1 maps to:
      • PUBLIC "-//W3C//ENTITIES Latin 1//EN//HTML" in HTML (the DTD is implicitly defined, no system URI is needed);
      • PUBLIC "-//W3C//ENTITIES Latin 1 for XHTML//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent" in XHTML 1.0;
    • HTMLsymbol maps to:
      • PUBLIC "-//W3C//ENTITIES Symbols//EN//HTML" in HTML (the DTD is implicitly defined, no system URI is needed);
      • PUBLIC "-//W3C//ENTITIES Symbols for XHTML//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent" in XHTML 1.0;
    • HTMLspecial maps to:
      • PUBLIC "-//W3C//ENTITIES Special//EN//HTML" in HTML (the DTD is implicitly defined, no system URI is needed);
      • PUBLIC "-//W3C//ENTITIES Special for XHTML//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent" in XHTML 1.0.
  3. ^ Old ISO subset: these are old (documented) character subsets used in legacy encodings before the unification within ISO 10646.
  4. ^ Description: the standard ISO 10646 and Unicode character name is displayed first for each character, with non-standard but legacy synonyms shown in italics between parentheses after an equal sign.
  5. ^ a b c d spaces: a blue background is used to display each space's width.
  6. ^ angst: The use of U+212B 'Angstrom sign', which was encoded due to round-trip mapping compatibility with an East-Asian character encoding, is discouraged, and the preferred representation is U+00C5 'capital letter A with ring above', which has the same glyph.
  7. ^ a b ijlig: The use of U+0132 and U+0133 'IJ ligature', which was encoded for usage in Dutch, and for compatibility for ISO/IEC 6937 and Code page 1102 (which only includes the lowercase ij; the Dutch version of ISO 646, National Replacement Character Set), is discouraged, and the preferred representation is simply IJ and ij (as two separate letters).
  8. ^ a b lmidot: The use of U+013F and U+0140 'L with middle dot', which was encoded for usage in Catalan, and for compatibility for ISO/IEC 6937, is discouraged, and the preferred representation is L/l followed by U+00B7.
  9. ^ napost: U+0149 'n preceded by apostrophe', which was encoded for usage in Afrikaans, and for compatibility for ISO/IEC 6937, has been deprecated by Unicode (since Unicode 5.2). The preferred representation is ʼn (U+02BC followed by n). (Unicode.org - Proposal for Additional Deprecated Characters).
  10. ^ a b ligature: this is a standard misnomer as this is a separate character in some languages.
  11. ^ ohm: The use of U+2126 'Ohm sign', is discouraged, and the preferred representation is U+03A9 'Greek capital letter Omega', which has the same glyph.
  12. ^ a b c d e black: here it seems to mean filled as opposed to hollow.
  13. ^ a b ISO proposed: these characters have been standardized in ISO 10646 after the release of HTML 4.0.
  14. ^ alefsym: 'alef symbol' is not the same as U+05D0 'Hebrew letter alef', although the same glyph could be used to depict both characters.
  15. ^ beth: 'bet symbol' is not the same as U+05D1 'Hebrew letter bet', although the same glyph could be used to depict both characters.
  16. ^ gimel: 'gimel symbol' is not the same as U+05D2 'Hebrew letter gimel', although the same glyph could be used to depict both characters.
  17. ^ daleth: 'dalet symbol' is not the same as U+05D3 'Hebrew letter dalet', although the same glyph could be used to depict both characters.
  18. ^ lArr: ISO 10646 does not say that 'leftwards double arrow' is the same as the 'is implied by' arrow, but also does not have any other character for that function. So lArr can be used for 'is implied by' as ISOtech suggests.
  19. ^ rArr: ISO 10646 does not say that 'rightwards double arrow' is the 'implies' character but does not have another character with this function, so rArr can be used for 'implies' as ISOtech suggests.
  20. ^ prod: 'n-ary product' is not the same character as U+03A0 'Greek capital letter Pi' though the same glyph might be used for both.
  21. ^ sum: 'n-ary summation' is not the same character as U+03A3 'Greek capital letter Sigma' though the same glyph might be used for both.
  22. ^ sim: 'tilde operator' is not the same character as U+007E 'tilde', although the same glyph might be used to represent both.
  23. ^ nsup: note that nsup, U+2285 'not a superset of', is in the ISOamsn subset, but is not covered by the Symbol font encoding and is not listed in the HTML 4.0 entities list on the documentation, but was erroneously omitted from the entities list; it should be included for symmetry and analogy with other entities.
  24. ^ perp: Unicode only defines U+22A5 as the "up tack". The Unicode symbol for "perpendicular" is U+27C2. The two symbols look similar, but are separate in Unicode. However, HTML uses U+22A5 as its "perpendicular" symbol. This is a discrepancy between HTML and Unicode. As well, the U+22A4 character (the "down tack" symbol) rendered in a browser such as Firefox 3.6 can match the font of either "up tack" or "perpendicular", but not both, depending on whether a fixed-width or a proportional font is used. When viewed in Firefox 3.6, the symbols rendered in the order U+22A5, U+22A4, U+27C2 in a proportional font: ⊥ ⊤ ⟂ and a fixed width one: ⊥ ⊤ ⟂, shows that the "down tack" has a similar look to U+22A5 (HTML's "perpendicular") in the first case but matches U+27C2 in the second. This exemplifies the difficulties of the semiotics involved in interpreting glyphs, symbols and characters generally.
  25. ^ sdot: U+22C5 'dot operator' is not the same character as U+00B7 'middle dot'.
  26. ^ U+22D8 does not have the lll entity in the HTML 5.2 list, but was erroneously omitted from the list.
  27. ^ lang: U+27E8 'mathematical left angle bracket' is not the same character as U+003C 'less than', U+2039 'single left-pointing angle quotation mark', or U+3008 'left angle bracket'. In HTML 5.0, lang has was remapped to this code, as U+2329 'left-pointing angle bracket' has been marked deprecated in Unicode (since version 5.2) (Unicode.org - Proposal for Additional Deprecated Characters).
  28. ^ rang: U+27E9 'mathematical right angle bracket' is not the same character as U+003E 'greater than', U+203A 'single right-pointing angle quotation mark', or U+3009 'right angle bracket'. In HTML 5.0, rang had been remapped to this code, as U+232A 'right-pointing angle bracket' has been marked deprecated in Unicode (since version 5.2) (Unicode.org - Proposal for Additional Deprecated Characters).

Entities representing special characters in XHTML[edit]

The XHTML DTDs explicitly declare 253 entities (including the 5 predefined entities of XML 1.0) whose expansion is a single character, which can therefore be informally referred to as "character entities". These (with the exception of the &apos; entity) have the same names and represent the same characters as the 252 character entities in HTML. Also, by virtue of being XML, XHTML documents may reference the predefined &apos; entity, which is not one of the 252 character entities in HTML 4. Additional entities of any size may be defined on a per-document basis. However, the usability of entity references in XHTML is affected by how the document is being processed:

  • If the document is read by a conforming HTML processor, then only the 252 HTML character entities can safely be used. The use of &apos; or custom entity references may not be supported and may produce unpredictable results.
  • If the document is read by an XML parser that does not or cannot read external entities, then only the five built-in XML character entities (see above) can safely be used, although other entities may be used if they are declared in the internal DTD subset.
  • If the document is read by an XML parser that does read external entities, then the five built-in XML character entities can safely be used. The other 248 HTML character entities can be used as long as the XHTML DTD is accessible to the parser at the time the document is read. Other entities may also be used if they are declared in the internal DTD subset.

Because of the special &apos; case mentioned above, only &quot;, &amp;, &lt;, and &gt; will work in all processing situations.

References[edit]

  1. ^ "HTML5 Named Character Reference List".

See also[edit]

  • Character encodings in HTML
  • HTML decimal character rendering
  • SGML entity
  • Digraph and Trigraph (a similar concept to enter unavailable characters)

Further reading[edit]

  • Unicode Consortium. See also: Unicode Consortium
    • UnicodeData.txt from the Unicode Consortium
  • World Wide Web Consortium. See also: World Wide Web Consortium
    • XML 1.0 spec
    • HTML 2.0 spec
    • HTML 3.2 spec
    • HTML 4.0 spec
    • HTML 4.01 spec
    • HTML 5 spec
    • XHTML 1.0 spec
    • XML Entity Definitions for Characters
  • The normative reference to RFC 2070 (still found in DTDs defining the character entities for HTML or XHTML) is historic; this RFC (along with other RFC's related to different part of the HTML specification) has been deprecated in favor of the newer informational RFC 2854 which defines the "text/html" MIME type and references directly the W3C specifications for the actual HTML content.
  • Numerical Reference of Unicode code points at Wikibooks

External links[edit]

  • Character entity references in HTML 4 at the W3C
  • Webpage for encoding and decoding special characters