肺间质纤维化是什么病| 粑粑黑色是什么原因| ss是什么意思| ida是什么意思| 说女人强势是什么意思| 少一颗牙齿有什么影响| 月季花什么时候开花| 孕妇梦到被蛇咬是什么意思| 脚上长鸡眼是什么原因| 梦见包饺子是什么征兆| 吃什么能流产| 四月23日是什么星座| 甲亢病是什么病| 不经意间是什么意思| 鸟屎掉手上有什么预兆| 罗汉果可以和什么一起泡水喝| 花生什么时候成熟| 胖大海是什么| 西凤酒什么香型| 经常口腔溃疡是什么原因引起的| 肺炎可以吃什么水果| 什么是反流性食管炎| 阿托品是什么| 安是什么生肖| 梦见两个小男孩是什么意思| 复杂囊肿是什么意思| 翻江倒海是什么生肖| 表面积是什么| 喝啤酒吃什么菜最好| 低筋面粉是什么| 114是什么意思| 贫血的人来姨妈会有什么症状| 10.28什么星座| 敦促的意思是什么| 日字五行属什么| 为什么一个月来两次月经| 形声字是什么意思| 月经不调吃什么药调理最好| 维生素b1有什么作用| 迎风流泪用什么眼药水| 血红蛋白低吃什么可以补起来| 十一月十五号是什么星座| 什么桥下没有水脑筋急转弯| 头晕目眩是什么病的征兆| 猫有什么品种| 创面是什么意思| 小燕子的尾巴像什么| 吃一个海参相当于吃了什么| 夏天有什么动物| rf是什么的缩写| 维生素什么牌子好| 开店做什么生意好| 就这样吧是什么意思| 懵的意思是什么| 尖锐湿疣吃什么药| 女性私处长痘痘是什么原因| 什么是理想| 301医院院长什么级别| 外科和内科有什么区别| 透疹是什么意思| 小猫来家里有什么预兆| 嘴苦是什么原因| 海胆是什么东西| 男性性功能下降是什么原因| 弓形虫抗体阳性是什么意思| 什么是尿失禁| 手汗症挂什么科| 血液粘稠吃什么药| 自汗吃什么中成药| 精炼植物油是什么油| 乳腺术后吃什么最好| 梦见去墓地是什么预兆| ooc是什么意思| 轮状胎盘是什么意思| 独代表什么生肖| 有骨气是什么意思| 孑孓什么意思| 武夷岩茶是什么茶| 除皱针什么牌子效果最好| 寄生虫吃什么药可以杀死| 蒙脱石是什么东西| 上24休24是什么意思| 肝胆相照是什么生肖| 长沙有什么学校| 五彩绳什么时候扔掉| 婴儿什么时候吃辅食| 冲代表什么生肖| 羊和什么属相最配| 吹面不寒杨柳风什么意思| 什么叫二氧化碳| 同型半胱氨酸高吃什么| 什么人喜欢天天下雨| 心口疼痛是什么原因| 怀孕吃什么有营养| 小儿病毒性感冒吃什么药效果好| 阿奇霉素和头孢有什么区别| 干燥症是什么症状| 儿童中耳炎用什么药最好| 宦官是什么意思| 火龙果和什么相克| 行政助理是干什么的| 眼皮红肿是什么原因| 1955属什么生肖| 趋势是什么意思| 本是同根生相煎何太急是什么意思| 茅台酒为什么这么贵| 万人空巷是什么意思| 牙齿经常出血是什么原因| 黄皮肤适合什么颜色的衣服| 空调多少匹是什么意思| 坤字五行属什么| 就藩什么意思| 改善是什么意思| 寄生茶在什么树上最好| 养猫的人容易得什么病| 吃雪燕有什么好处| 尿液阳性是什么意思| 1940年出生属什么生肖| 吃什么可以让奶水增多| 经常打嗝是什么原因引起的| 女人一般什么时候绝经| 明信片是什么| 动手术后吃什么对伤口恢复比较快| 喉咙咳出血是什么原因| 异地办理临时身份证需要什么材料| 破釜沉舟是什么意思| 偶尔是什么意思| 舌苔黄是什么原因| 负责是什么意思| 粉玫瑰花语是什么意思| 男士去皱纹用什么好| 水痘能吃什么食物| 补刀什么意思| 球蛋白有什么作用和功效| 大姨妈来了吃什么水果好| 长寿花什么时候开花| 斛什么意思| 支气管炎吃什么药效果最好| 毕业礼物送什么| 荣五行属什么| 经常不吃晚饭对身体有什么影响| jbl是什么牌子| 距离产生美是什么意思| 什么水果通便| 梦见磕头下跪什么意思| 失眠吃什么水果| 吃什么变碱性体质最快| 僵尸车是什么意思| 4朵玫瑰代表什么意思| 母鸡什么意思| 印第安老斑鸠什么意思| 就坡下驴什么意思| 溦是什么意思| 减肥为什么让早上空腹喝咖啡| 心脏早搏是什么症状| 病理报告是什么意思| 爸爸的姐夫叫什么| 教师节送老师什么礼物最好| 狐臭挂什么科室的号| 梦见一个人代表什么| 上胸围90下胸围80是什么罩杯| 喘息性支气管炎吃什么药| 小孩子流鼻血是什么原因引起的| 经常感冒吃什么提高免疫力| 有鸟飞进屋是什么预兆| 思念到极致是什么感觉| 物以类聚人以群分什么意思| 啤酒加鸡蛋有什么功效| 例假量少是什么原因| 胃酸不能吃什么食物| 结婚送什么| 豕是什么动物| 明朝北京叫什么| 琪是什么意思| 什么是代偿| 蹦蹦跳跳的动物是什么生肖| 肠梗阻什么症状| 阴疽是什么意思| 婴儿拉肚子是什么原因造成的| 圆滑是什么意思| 脉弱是什么意思| 亚麻籽和什么相克| 息斯敏是什么药| 吐痰带血是什么原因| 牙松动了还疼用什么方法处理最好| 孕妇喝柠檬水对胎儿有什么好处| 看好你是什么意思| 胃不好吃什么| 毛囊是什么样子图片| 气得什么| 吃什么补气补血最见效| 十九朵玫瑰花代表什么意思| 蓝本是什么意思| 左腰疼痛是什么原因男性| 六月十三日是什么星座| 零反式脂肪是什么意思| 龙凤呈祥是什么意思| 肺不好的人吃什么好| 青少年吃什么钙片有助于长高| 15年什么婚| 5月17日是什么星座| 头昏是什么原因引起的| 交通运输是干什么的| ards是什么病| 小孩表演后卸妆用什么| 蟑螂长什么样| 首长是什么意思| 受戒是什么意思| 大便失禁是什么原因| 什么的小河| 后背疼痛挂什么科| 猫不喜欢什么味道| 反乌托邦什么意思| 农垦局是什么性质单位| 尿毒症是什么原因导致的| 胎发什么时候剃最合适| 静置是什么意思| 渡船是什么意思| 入职体检70元一般检查什么| 典狱长是什么意思| gd什么意思| 版记是什么| 多囊是什么原因引起的| rebecca什么意思| 息斯敏又叫什么药名| 6月3日什么星座| 腔隙性脑梗死吃什么药| 痔疮什么样| 取环挂什么科室| 什么是肾功能不全| 小排畸主要查什么| 妍字属于五行属什么| 胃窦糜烂是什么意思| 不以规矩下一句是什么| 愚痴是什么意思| 茭头是什么| 孕酮低吃什么补得快| 尔尔是什么意思| 腿困是什么原因引起的| 男生生日礼物送什么| 热伤风是什么意思| 无妄之灾什么意思| 脚底发红是什么原因| 上升星座是什么| 中国是什么时区| 房产证和土地证有什么区别| 自私是什么意思| 脉沉细是什么意思| 为什么广西女孩子好娶| 流沙是什么意思| 亲子是什么意思| 除湿气吃什么好| 贪狼是什么意思| 邮政ems是什么意思| 姓陈取什么名字好听| 谷子是什么意思| 腰椎退行性变是什么意思| 米为什么会生虫| 怀孕10多天有什么症状| 东莞五行属什么| 夏天喝什么茶好| fierce是什么意思| 左卡尼汀口服溶液主要治疗什么| 女同是什么| 百度
  1. 14 The XML syntax
    1. 14.1 Writing documents in the XML syntax
    2. 14.2 Parsing XML documents
    3. 14.3 Serializing XML fragments
    4. 14.4 Parsing XML fragments

14 The XML syntax

HTML/XHTML

Support in all current engines.

Firefox2+Safari3.1+Chrome4+
Opera9+Edge79+
Edge (Legacy)12+Internet Explorer9+
Firefox Android4+Safari iOS2+Chrome Android18+WebView Android2+Samsung Internet1.0+Opera Android10.1+

This section only describes the rules for XML resources. Rules for text/html resources are discussed in the section above entitled "The HTML syntax".

14.1 Writing documents in the XML syntax

The XML syntax for HTML was formerly referred to as "XHTML", but this specification does not use that term (among other reasons, because no such term is used for the HTML syntaxes of MathML and SVG).

The syntax for XML is defined in XML and Namespaces in XML. [XML] [XMLNS]

This specification does not define any syntax-level requirements beyond those defined for XML proper.

XML documents may contain a DOCTYPE if desired, but this is not required to conform to this specification. This specification does not define a public or system identifier, nor provide a formal DTD.

According to XML, XML processors are not guaranteed to process the external DTD subset referenced in the DOCTYPE. This means, for example, that using entity references for characters in XML documents is unsafe if they are defined in an external file (except for <, >, &, ", and ').

14.2 Parsing XML documents

This section describes the relationship between XML and the DOM, with a particular emphasis on how this interacts with HTML.

An XML parser, for the purposes of this specification, is a construct that follows the rules given in XML to map a string of bytes or characters into a Document object.

At the time of writing, no such rules actually exist.

An XML parser is either associated with a Document object when it is created, or creates one implicitly.

This Document must then be populated with DOM nodes that represent the tree structure of the input passed to the parser, as defined by XML, Namespaces in XML, and DOM. When creating DOM nodes representing elements, the create an element for a token algorithm or some equivalent that operates on appropriate XML data structures must be used, to ensure the proper element interfaces are created and that custom elements are set up correctly.

For the operations that the XML parser performs on the Document's tree, the user agent must act as if elements and attributes were individually appended and set respectively so as to trigger rules in this specification regarding what happens when an element is inserted into a document or has its attributes set, and DOM's requirements regarding mutation observers mean that mutation observers are fired. [XML] [XMLNS] [DOM] [UIEVENTS]

Between the time an element's start tag is parsed and the time either the element's end tag is parsed or the parser detects a well-formedness error, the user agent must act as if the element was in a stack of open elements.

This is used by various elements to only start certain processes once they are popped off of the stack of open elements.

This specification provides the following additional information that user agents should use when retrieving an external entity: the public identifiers given in the following list all correspond to the URL given by this link. (This URL is a DTD containing the entity declarations for the names listed in the named character references section.) [XML]

Furthermore, user agents should attempt to retrieve the above external entity's content when one of the above public identifiers is used, and should not attempt to retrieve any other external entity's content.

This is not strictly a violation of XML, but it does contradict the spirit of XML's requirements. This is motivated by a desire for user agents to all handle entities in an interoperable fashion without requiring any network access for handling external subsets. [XML]

XML parsers can be invoked with XML scripting support enabled or XML scripting support disabled. Except where otherwise specified, XML parsers are invoked with XML scripting support enabled.

When an XML parser with XML scripting support enabled creates a script element, it must have its parser document set and its force async set to false. If the parser was created as part of the XML fragment parsing algorithm, then the element's already started must be set to true. When the element's end tag is subsequently parsed, the user agent must perform a microtask checkpoint, and then prepare the script element. If this causes there to be a pending parsing-blocking script, then the user agent must run the following steps:

  1. Block this instance of the XML parser, such that the event loop will not run tasks that invoke it.

  2. Spin the event loop until the parser's Document has no style sheet that is blocking scripts and the pending parsing-blocking script's ready to be parser-executed is true.

  3. Unblock this instance of the XML parser, such that tasks that invoke it can again be run.

  4. Execute the script element given by the pending parsing-blocking script.

  5. Set the pending parsing-blocking script to null.

Since the document.write() API is not available for XML documents, much of the complexity in the HTML parser is not needed in the XML parser.

When the XML parser has XML scripting support disabled, none of this happens.

When an XML parser would append a node to a template element, it must instead append it to the template element's template contents (a DocumentFragment node).

This is a willful violation of XML; unfortunately, XML is not formally extensible in the manner that is needed for template processing. [XML]

When an XML parser creates a Node object, its node document must be set to the node document of the node into which the newly created node is to be inserted.

Certain algorithms in this specification spoon-feed the parser characters one at a time. In such cases, the XML parser must act as it would have if faced with a single string consisting of the concatenation of all those characters.

When an XML parser reaches the end of its input, it must stop parsing, following the same rules as the HTML parser. An XML parser can also be aborted, which must again be done in the same way as for an HTML parser.

For the purposes of conformance checkers, if a resource is determined to be in the XML syntax, then it is an XML document.

14.3 Serializing XML fragments

The XML fragment serialization algorithm for a Document or Element node either returns a fragment of XML that represents that node or throws an exception.

For Documents, the algorithm must return a string in the form of a document entity, if none of the error cases below apply.

For Elements, the algorithm must return a string in the form of an internal general parsed entity, if none of the error cases below apply.

In both cases, the string returned must be XML namespace-well-formed and must be an isomorphic serialization of all of that node's relevant child nodes, in tree order. User agents may adjust prefixes and namespace declarations in the serialization (and indeed might be forced to do so in some cases to obtain namespace-well-formed XML). User agents may use a combination of regular text and character references to represent Text nodes in the DOM.

A node's relevant child nodes are those that apply given the following rules:

For template elements
The relevant child nodes are the child nodes of the template element's template contents, if any.
For all other nodes
The relevant child nodes are the child nodes of node itself, if any.

For Elements, if any of the elements in the serialization are in no namespace, the default namespace in scope for those elements must be explicitly declared as the empty string. (This doesn't apply in the Document case.) [XML] [XMLNS]

For the purposes of this section, an internal general parsed entity is considered XML namespace-well-formed if a document consisting of an element with no namespace declarations whose contents are the internal general parsed entity would itself be XML namespace-well-formed.

If any of the following error cases are found in the DOM subtree being serialized, then the algorithm must throw an "InvalidStateError" DOMException instead of returning a string:

These are the only ways to make a DOM unserialisable. The DOM enforces all the other XML constraints; for example, trying to append two elements to a Document node will throw a "HierarchyRequestError" DOMException.

14.4 Parsing XML fragments

The XML fragment parsing algorithm given an Element node context and a string input, runs the following steps. They return a list of nodes.

  1. Create a new XML parser.

  2. Feed the parser just created the string corresponding to the start tag of context, declaring all the namespace prefixes that are in scope on that element in the DOM, as well as declaring the default namespace (if any) that is in scope on that element in the DOM.

    A namespace prefix is in scope if the DOM lookupNamespaceURI() method on the element would return a non-null value for that prefix.

    The default namespace is the namespace for which the DOM isDefaultNamespace() method on the element would return true.

    No DOCTYPE is passed to the parser, and therefore no external subset is referenced, and therefore no entities will be recognized.

  3. Feed the parser just created the string input.

  4. Feed the parser just created the string corresponding to the end tag of context.

  5. If there is an XML well-formedness or XML namespace well-formedness error, then throw a "SyntaxError" DOMException.

  6. If the document element of the resulting Document has any sibling nodes, then throw a "SyntaxError" DOMException.

  7. Return the resulting Document node's document element's children, in tree order.

百度