XML语法要点
XML Syntax OutLine
写于2008年8月2日
1、所有的XML元素必须有成对的标记。
(All XML Elements Must Have a Closing Tag)
2、XML标记区分大小写(对大小写敏感)。
(XML Tags are Case Sensitive)
3、所有的XML标记必须顺序闭合。
(XML Elements Must be Properly Nested)
4、每个XML文档必须有一个根元素。
(XML Documents Must Have a Root Element)
5、XML元素的属性必须用引号引用。
(XML Attribute Values Must be Quoted)
6、特殊字符需要进行实体引用。
(Entity References)
注意:只有字符"<"和"&"造成严格语法错误,">"一般情况是合法的,但也建议将其进行实体引用。
(Note: Only the characters "<" and "&" are strictly illegal in XML. The greater than character is legal, but it is a good habit to replace it.)
< |
< |
less than |
> |
> |
greater than |
& |
& |
ampersand |
' |
' |
apostrophe |
" |
" |
quotation mark |
7、XML文档中注释的格式。
(Comments in XML)
8、注意空格会被缩减。
(With XML, White Space is Preserved)
HTML: |
Hello my name is Tove |
Output: |
Hello my name is Tove. |
9、XML用LF表示新的一行。
(XML Stores New Line as LF)
注意:Windows程序中,新的一行用一个CR和一个LF表示;
Unix程序中,仅用一个LF表示;
苹果程序中,仅用一个CR表示。
In Windows applications, a new line is normally stored as a pair of characters: carriage return (CR) and line feed (LF). The character pair bears some resemblance to the typewriter actions of setting a new line. In Unix applications, a new line is normally stored as a LF character. Macintosh applications use only a CR character to store a new line.
阅读(1322) | 评论(0) | 转发(0) |