Статус: Эксперт
Группы: Участники
Зарегистрирован: 05.03.2015(UTC) Сообщений: 1,602 Откуда: Иркутская область Сказал(а) «Спасибо»: 110 раз Поблагодарили: 393 раз в 366 постах
|
Цитата:Как можно заметить, в xml используются русские символы в доменах и путях URL в пространствах имен, что не соответствует RFC, однако реальность требует работы с такими документами. Как я понимаю, насчет несоответсия дело обстоит немного по-другому. Если Вы о RFC 3986, то там: да, описан способ представлять URI как ограниченный набор символов глобально, но потом выводят определение более широкого набора символов для регионов (если позволяют технологии) за рамки этого RFC (а чем обмен с ПФР не региональный контекст для России?).
https://www.ietf.org/rfc/rfc3986.txt Цитата:1.2.1. Transcription A URI is a sequence of characters from a very limited set: the letters of the basic Latin alphabet, digits, and a few special characters. парой абзацев ниже: Цитата:In local or regional contexts and with improving technology, users might benefit from being able to use a wider range of characters; such use is not defined by this specification. Причем предположили, но не навязали как можно совместить одно с другим: Цитата:Percent-encoded octets (Section 2.1) may be used within a URI to represent characters outside the range of the US-ASCII coded character set if this representation is allowed by the scheme or by the protocol element in which the URI is referenced. Such a definition should specify the character encoding used to map those characters to octets prior to being percent-encoded for the URI. Цитата:2.5. Identifying Data When a new URI scheme defines a component that represents textual data consisting of characters from the Universal Character Set [UCS], the data should first be encoded as octets according to the UTF-8 character encoding [STD63]; then only those octets that do not correspond to characters in the unreserved set should be percent-encoded. For example, the character A would be represented as "A", the character LATIN CAPITAL LETTER A WITH GRAVE would be represented as "%C3%80", and the character KATAKANA LETTER A would be represented as "%E3%82%A2".
Потом еще упоминают про DNS и не ASCII домены: Цитата:URI producers should provide these registered names in the IDNA encoding, rather than a percent-encoding, if they wish to maximize interoperability with legacy URI resolvers. Смотрим дальше не противоречит ли другим стандартам: русская кириллица представлена символами с кодами x401, x410-x44F, x451 в Юникоде. Проверяем символы в стандарте XML - использовать можно во всех именах (включая значения атрибутов, куда этим стандартом отнесены и адреса пространств имен):
https://www.w3.org/TR/xml/#charsets Код:Character Range
[2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] /* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */
[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
[40] STag ::= '<' Name (S Attribute)* S? '>' [WFC: Unique Att Spec]
[41] Attribute ::= Name Eq AttValue [VC: Attribute Value Type]
[WFC: No External Entity References]
[WFC: No < in Attribute Values]
[10] AttValue ::= '"' ([^<&"] | Reference)* '"'
| "'" ([^<&'] | Reference)* "'"
[67] Reference ::= EntityRef | CharRef
[66] CharRef ::= '&#' [0-9]+ ';'
| '&#x' [0-9a-fA-F]+ ';' [WFC: Legal Character]
[68] EntityRef ::= '&' Name ';' [WFC: Entity Declared]
[VC: Entity Declared]
[WFC: Parsed Entity]
[WFC: No Recursion]
Продолжаем в Namespaces in XML. Тут ссылаются на RFC3986 как представлять URI, но парой разделов ниже способ представления "с процентами" из RFC3986 строго не рекомендуют. Зато в плане символов берут определение Name из стандарта XML и исключают из него двоеточие, то есть все остальные символы включая кириллические допустимы (в префиксах в том числе). В плане значения атрибута отпределения пространства имен еще интереснее, написано что нормализованное значение должно быть или URI или пустое, то есть, как я понимаю, в документе может быть указано не нормализованное значение, но которое можно привести к нормализованному, соответствующему RFC3986. Повторюсь, значение "с процентами" указывать нельзя. В тоже время использовать зарегистрированные имена DNS доменов считается допустимым.
https://www.w3.org/TR/xml-names/ Цитата:2.1 Basic Concepts Definition: An XML namespace is identified by a URI reference [RFC3986]; element and attribute names may be placed in an XML namespace using the mechanisms described in this specification. 2.2 Use of URIs as Namespace Names The empty string, though it is a legal URI reference, cannot be used as a namespace name. The use of relative URI references, including same-document references, in namespace declarations is deprecated.
2.3 Comparing URI References Definition: The two URIs are treated as strings, and they are identical if and only if the strings are identical, that is, if they are the same sequence of characters. The comparison is case-sensitive, and no %-escaping is done or undone. A consequence of this is that URI references which are not identical in this sense may resolve to the same resource. Examples include URI references which differ only in case or %-escaping Because of the risk of confusion between URIs that would be equivalent if dereferenced, the use of %-escaped characters in namespace names is strongly discouraged. Цитата:3 Declaring Namespaces [1] NSAttName ::= PrefixedAttName | DefaultAttName [2] PrefixedAttName ::= 'xmlns:' NCName [NSC: Reserved Prefixes and Namespace Names] [3] DefaultAttName ::= 'xmlns' [4] NCName ::= Name - (Char* ':' Char*) /* An XML Name, minus the ":" */
The attribute's normalized value MUST be either a URI reference — the namespace name identifying the namespace — or an empty string. The namespace name, to serve its intended purpose, SHOULD have the characteristics of uniqueness and persistence. It is not a goal that it be directly usable for retrieval of a schema (if any exists). Uniform Resource Names [RFC2141] is an example of a syntax that is designed with these goals in mind. However, it should be noted that ordinary URLs can be managed in such a way as to achieve these same goals.
[7] QName ::= PrefixedName | UnprefixedName [8] PrefixedName ::= Prefix ':' LocalPart [9] UnprefixedName ::= LocalPart [10] Prefix ::= NCName [11] LocalPart ::= NCName
Исходя из всего, я делаю вывод, что кириллица в адресах пространств имен не запрещена (как региональный стандарт), но поддержку регионального стандарта от зарубежных библиотек ждать не приходится. Отредактировано пользователем 27 января 2020 г. 22:48:17(UTC)
| Причина: Не указана
|