问题
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 (
-) inA - Bmatches 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