水鸭跟什么煲汤最佳| 前身是什么意思| 1月份是什么星座的人| 什么时候恢复的高考| 肚子里面跳动是什么原因| 外阴干裂用什么药| 淋巴细胞高是什么意思| 女生自慰什么感觉| 经常看手机有什么危害| 5月23日是什么星座| 青海省会城市叫什么| 打了封闭针后要注意什么事项| 关节痛挂号挂什么科| 洋葱不能和什么食物一起吃| 韩后属于什么档次| 小便不利什么意思| 惴惴不安什么意思| 猥琐男是什么意思| 心脏官能症吃什么药| 什么运动能长高| 什么相照| 干眼症用什么药最好| 什么叫四大皆空| 脐橙什么意思| 女人的胸长什么样| 一个月不来月经是什么原因| 无常是什么意思| 老流鼻血是什么原因| 六八年属什么| 太形象了是什么意思| 什么心什么心| 氨酶偏高是什么意思| 医院总务科是干什么的| 神经性皮炎用什么药| 烧心是什么原因| 拉条子是什么意思| rh因子阳性是什么意思| 芭蕉和香蕉有什么区别| 电解质氯高是什么原因| 茉莉花有什么功效| 热病是什么病| 吃土豆有什么好处| 薄姬为什么讨厌窦漪房| 烟火气息是什么意思| 琼脂是什么东西| 血小板偏低有什么危害| pvd是什么材料| hl什么意思| 人体最大的消化腺是什么| 碱性食物都有什么| 小孩肠胃炎吃什么药| 舌苔发白是什么原因呢| 脱俗是什么意思| 阑尾粪石是什么意思| 为什么合欢树又叫鬼树| sansui是什么牌子| 辛巳五行属什么| 梅毒长什么样子| 什么是素数| 大仙为什么知道你的事| 逆时针揉肚子起什么作用| 肆无忌惮的意思是什么| 什么是色拉油| 刘姥姥进大观园什么意思| 李子是什么颜色| 女性尿路感染什么原因引起的| 甲醇和乙醇有什么区别| 阳绿翡翠属于什么级别| 人为什么会死亡| 尿道炎吃什么药最好| 大雄宝殿是什么意思| 切什么意思| 驴血是什么颜色| vivo是什么牌子| 呵呵的含义是什么意思| 月子里头疼是什么原因| 鱼刺卡喉咙去医院挂什么科| 滴虫性阴道炎用什么药好| 高血脂吃什么食物最好| 男生下巴长痘痘是什么原因| max什么意思| 浸猪笼是什么意思| 什么的树影| 儿郎是什么意思| 割礼是什么意思| 取经是什么意思| 穿山甲吃什么| 什么杯子喝水最健康| 立冬是什么时候| 女性尿路感染挂什么科| 什么有所什么| 海马萎缩是什么情况| 贝加台念什么| 588是什么意思| 包头古代叫什么| 黄花胶是什么鱼的胶| 官员出狱后靠什么生活| 肩膀上的肌肉叫什么| 忖量是什么意思| dw手表是什么档次| 睡眠时间短是什么原因| 廿二是什么意思| 什么是夫妻宫| 嫖娼是什么意思| 头晕眼睛模糊是什么原因| 喷昔洛韦乳膏治什么| 路人甲是什么意思| 胃酸过多吃什么| 左后脑勺疼是什么原因| 梦到水是什么意思| us检查是什么意思| 今年属于什么生肖| chd医学上是什么意思| pending是什么状态| 角质增生是什么意思| 什么是预科班| 拉油便是什么原因| 啤酒鸭可以放什么配菜| airwalk是什么牌子| 火把节是什么节日| 排卵期身体有什么症状表现吗| 什么姓氏好听| 头发有点黄是什么原因| 肩膀疼是什么原因| 爱是个什么东西| 什么是什么非| 牙结石用什么牙膏最好| 肩周炎挂什么科| 1971年是什么年| 生殖细胞瘤是什么病| 李思思为什么离开央视| 现在是什么季节| 尿道疼是什么原因| 门口放什么植物好风水| 梦到门坏了是什么意思| lcc是什么意思| 过剩是什么意思| 中国肤药膏有什么功效| 子宫直肠凹积液是什么意思| 白色念珠菌是什么病| 脑梗怎么形成的原因是什么| 曹曦月演过什么电视剧| 男孩长虎牙预示什么| 香肠炒什么菜好吃| 腹腔肠系膜淋巴结是什么病| 胰腺在人体什么部位| rh因子阳性是什么意思| 三个吉念什么| 打脸是什么意思| nt是什么币| 卤牛肉用什么部位| 猴魁属于什么茶| 收放自如是什么意思| 神经性头疼是什么原因造成的| 腺肌症有什么症状| 飞机打多了会有什么严重的后果吗| 红顶商人是什么意思| 鹅蛋炒香菜治什么病| 什么动物怕水| 阑尾炎吃什么药| gbs筛查是什么| 三月二十三是什么星座| 双侧腋窝淋巴结可见什么意思| 猫为什么流眼泪| 3.8号是什么星座| 提前吃什么药喝酒不醉| 同事过生日送什么礼物| 头发一把一把的掉是什么原因| 什么情况下吃救心丸| 孝庄是康熙的什么人| 簸箕是什么| 气胸叩诊呈什么音| 86年属什么生肖| 头发长的快是什么原因| 什么是朱砂| cr是什么检查| 子午相冲是什么生肖| 为什么不能随便看手相| 女人下面水多是什么原因| 姓袁女孩叫什么名字好听| 伤官是什么| 小狗吐白沫不吃东西没精神吃什么药| 石斛念什么| 别扭是什么意思| 6.1号是什么星座| 割包皮去医院挂什么科| 桃子有什么营养价值| 偏头痛看什么科| 尿道口流脓吃什么药| 腰疼是什么原因| 暗经是什么意思| 肺肾两虚吃什么中成药| 星期三打喷嚏代表什么| 清炖排骨汤放什么调料| 什么减肥药有效果| handmade是什么牌子| 香港迪士尼什么时候开业的| 肠镜活检意味着什么| 谈什么色变| 淋巴细胞低是什么原因| 村里入党需要什么条件| 斑马鱼吃什么| 桂花是什么颜色的| 精液是什么味道的| 半夜猫叫有什么预兆| 呼吸快是什么原因| 金项链断了有什么预兆| 腼腆什么意思| 可喜可贺是什么意思| 爱困总想睡觉什么原因| 滞留针是什么| 漳平水仙茶属于什么茶| 气血亏吃什么补的快| 有个马的标志是什么车| 什么时候买机票便宜| 7月8号是什么星座的| 什么叫钙化| 黄水疮用什么药膏最快| 海参几头是什么意思| 头皮屑是什么| KH是什么| leep是什么手术| 抽搐是什么意思| 梦见打井是什么意思| 伏天从什么时候开始| 什么是银屑病| 朱字五行属什么| 什么姿势最深| 数字5代表什么意思| 左眼皮跳是什么预兆呢| 吃什么保养皮肤| 山己念什么| 试纸一深一浅说明什么| 肚脐眼左边疼是什么原因| 什么茶下火| 查肾功能需要做什么检查| 6月适合种什么菜| 宝宝吃什么增强抵抗力| 弯男是什么意思| 开字加一笔是什么字| 狗摇尾巴是什么意思| 做血常规检查挂什么科| 下连是什么意思| 足跟疼挂什么科室| 烟头属于什么垃圾| 骨盆前倾挂什么科| 激光是什么| 大便稀溏是什么意思| 高锰酸钾加什么会爆炸| 胃寒吃什么好| jomalone是什么牌子| 吃什么降三高最快| 女人为什么会宫外怀孕| 右额头上有痣代表什么| 械字号产品是什么意思| 抉择是什么意思| 什么什么有力| 为什么老是想吐| 用什么自慰| 康复科是主要治疗什么| 无咎是什么意思| 经常吃南瓜有什么好处和坏处| 题词是什么意思| 阅兵什么意思| 百度
  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.

百度