Bar Harel
Bar Harel

Reputation: 35

In a XML, can an element that contains nested elements, contain text?

The title pretty much sums up my question. Here is an example:

 <OuterElement name="a">
     <InnerElement>InnerElementText</InnerElement>
     OuterElementText
 </OuterElement>

Is this OK? Thank you!

Upvotes: 1

Views: 73

Answers (1)

Damien_The_Unbeliever
Damien_The_Unbeliever

Reputation: 239804

Yes, it's called mixed content:

An element type has mixed content when elements of that type may contain character data, optionally interspersed with child elements

To declare it as such in an XSD schema, one would use complexContent with mixed="true" (Microsoft link but similar documentation available elsewhere and it's not MS specific)

Upvotes: 2

Related Questions