I'm having difficulty writing my xml schema (.xsd) file. My xml file contains a recursive element para which in turn has mixed elements within.

The element para contains either text only or it contains 0 or more sub-elements para and/or it contains 0 or more element footnotes or/and it contains 0 or more elements emphasis.

Footnotes in turn may contain subelement para which in turn contains text and/or footnotes and/or emphasis, etc.

Here's my abcad.xsd file

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

	<xs:element name="content">
		<xs:complexType mixed="true">
			<xs:sequence>
				<xs:choice maxOccurs="unbounded">
					<xs:element name="para">
						<xs:complexType mixed="true">
							<xs:sequence minOccurs="0">
								<xs:element name="emphasis" type="xs:string" />
							</xs:sequence>
						</xs:complexType>
				
					<xs:element name="footnote" >
						<xs:complexType mixed="true">
							<xs:sequence minOccurs="0" maxOccurs="unbounded">
								<xs:element name="para" type="xs:string" />
							</xs:sequence>
						</xs:complexType>
					</xs:element>
					</xs:element>
				</xs:choice>
			</xs:sequence>
		</xs:complexType>
	</xs:element>

</xs:schema>

Here's my abcad.xml file

<?xml version="1.0" encoding="UTF-8"?>
<content xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="abcad.xsd">
		<para>Here at Bill Smiggins Inc. we're really proud of our
			ten-year reputation for the development of quality
			products. We're sorry to hear that you were unhappy
			with the Combined Trouser Press and Waffle Maker that
			you recently purchased from us. I can only restate that
			it was in full working order when we shipped, and the
			presence of fluff in your breakfast waffles was as much
			of a shock to us, as we're sure it was to you.</para>

		<para>
			If you return the Combined Trouser Press and Waffle
			Maker in its original packaging, we'll arrange a full
			refund
			<footnote>
				<para>
					Please note, we will not pay the
					cost of shipping goods back to us.
				</para>


			</footnote>




			. More to say.
			</para>
			<para>
				Bill Smiggins Inc. Giving you the
				<emphasis>
					quality
             			</emphasis>
				of service you deserve.
			</para>
	</content>

Error: 16: cvc-complex-type.2.4.a: Invalid content was found starting with element 'footnote'. One of '{emphasis}' is expected.

Sorry. I shouldn't have been trying to make it recursive. I got it working.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.