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

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.

Leave a Comment