Can a XML element contain text and child elements at the same time?

前端 未结 2 1928
梦毁少年i
梦毁少年i 2020-12-15 15:52

I was looking at some xml files but didn\'t find the answer to my question: Can a XML element contain text and child elements at the same time?

For example:

相关标签:
2条回答
  • 2020-12-15 16:25

    Yes. It's called "mixed content".

    0 讨论(0)
  • 2020-12-15 16:28

    Yes. A parent node contains zero or more child nodes. Text nodes and element nodes are two kinds of nodes and an element node can have any number of text and/or element child nodes in any order. Schemas might restrict this, though. In fact, the whitespace between element nodes actually forms text node siblings. Usually this whitespace is ignored, though.

    0 讨论(0)
提交回复
热议问题