Minus in w3c specification grammar

依然范特西╮ 提交于 2020-12-11 04:15:47

问题


What does the minus sign mean?

[14]    CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*)

From the w3c XML 1.0 specification

Also, where can I find information related to the syntax grammar? I'm having troubling finding the specification about the specification, if that makes any sense.


回答1:


Minus (-) is part of the Extended Backus-Naur Form (EBNF) notation used by the W3C XML Recommendation to define the formal grammar of XML:

  • Minus (-) in A - B matches any string that matches A but does not match B.

How to interpret the CharData production

[14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*)

  • [^<&]* is a string of any characters except the markup start characters, < and &.
  • ']]>' is a literal string that is used to mark the end of CDATA.
  • ([^<&]* ']]>' [^<&]*) is any string without < and & that doesn't contain the end marker for a CDATA section.

Therefore, altogether, CharData can be any string that doesn't contain the markup start characters, < and &, and doesn't contain the CDATA end marker, ]]>.

See also

  • Understanding XML CharData EBNF


来源:https://stackoverflow.com/questions/44955763/minus-in-w3c-specification-grammar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!