Reputation: 110382
In reading the XML spec, it mentions the following definitions:
Names and Tokens
[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]
[5] Name ::= NameStartChar (NameChar)*
Literals
[9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"' | "'" ([^%&'] | PEReference | Reference)* "'"
[10] AttValue ::= '"' ([^<&"] | Reference)* '"'| "'" ([^<&'] | Reference)* "'"
[11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'")
[12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
[13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
What would be an example of a Name vs. an Entity vs an Attribute vs a SystemLiteral vs a Pubid (?)
For example in the below:
<Item id="123">Hello<Item/>
Is Item
the Name or the EntityValue? And I would assume that 123
or "123"
would be the Att(ribute)Value. Are those both correct? What would be examples of the others?
From the spec it says:
Literal data is any quoted string not containing the quotation mark used as a delimiter for that string. Literals are used for specifying the content of internal entities (EntityValue), the values of attributes (AttValue), and external identifiers (SystemLiteral).
So from that I would think Item
would be the EntityValue, 123
would be the AttrValue: what would be examples of a PubID and SystemLiteral then? Finally, why doesn't the EntityValue
exclude the <
and >
chars?
Upvotes: 1
Views: 99
Reputation: 111696
Your XML example is parsed as follows:
<Item id="123">Hello<Item/>
is an element:
<Item id="123">
is an STag:
Hello
is content, which is CharData in this example.<Item/>
is an ETag:
Item
is a Name.There are none of the following constructs in your example:
"2020"
in <!ENTITY year "2020">
"-//W3C//DTD HTML 4.01//EN"
in <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
)"../img/logo.gif"
in <!ENTITY logo SYSTEM "../img/logo.gif" NDATA gif >
See section 4.2 Entity Declarations for more context on how EntityValue
, PubidLiteral
, and SystemLiteral
are used.
Upvotes: 3