Is there any difference between 'valid xml' and 'well formed xml'?

前端 未结 14 2751
清酒与你
清酒与你 2020-11-21 04:43

I wasn\'t aware of a difference, but a coworker says there is, although he can\'t back it up. What\'s the difference if any?

14条回答
  •  失恋的感觉
    2020-11-21 05:48

    Valid XML is XML that succeeds validation against a DTD.

    Well formed XML is XML that has all tags closed in the proper order and, if it has a declaration, it has it first thing in the file with the proper attributes.

    In other words, validity refers to semantics, well-formedness refers to syntax.

    So you can have invalid well formed XML.

提交回复
热议问题