document ::= prolog?,element+,Misc*
prolog
prolog ::= XMLDecl? Misc* (doctypedecl Misc*)?
XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
VersionInfo ::= S 'version' Eq ("'" VersionNum "'" | '"' VersionNum '"')
EncodingDecl ::= S 'encoding' Eq ('"' EncName '"' | "'" EncName "'" )
SDDecl ::= S 'standalone' Eq (("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no') '"'))
Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'
S ::= (#x20 | #x9 | #xD | #xA)+
PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'
<![CDATA[ " and end with the string " ]]>
Misc ::= Comment | PI | S
doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S? ('[' intSubset ']' S?)? '>'
ExternalID ::= 'SYSTEM' S SystemLiteral | 'PUBLIC' S PubidLiteral S SystemLiteral
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE greeting SYSTEM "hello.dtd"> <greeting>Hello,world!</greeting>
原文链接:https://www.f2er.com/xml/297901.html