Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSD - trying to understand complextypes 1

Status
Not open for further replies.

Ferrian

Programmer
Sep 7, 2005
53
GB
I have been given a set of XSD documents by a company in order to pass them data. They are a huge sprawling series of interconnecting types and it is taking hours to unravel it all.

I am fairly new to XML and completely new to XSD so I have been learning a lot, but I am stumped by one section of XML:

XML:
	<xs:complexType name="btx" mixed="true">
		<xs:choice minOccurs="0" maxOccurs="unbounded">
			<xs:element ref="FT"/>
			<xs:element ref="P"/>
		</xs:choice>
	</xs:complexType>

	<xs:element name="P" type="btx"/>

	<xs:complexType name="ft" mixed="true">
		<xs:complexContent mixed="true">
			<xs:extension base="btx">
				<xs:attribute name="TYPE">
					<xs:simpleType>
						<xs:restriction base="xs:NMTOKEN">
							<xs:enumeration value="REFOJ"/>
							<xs:enumeration value="SUB"/>
							<xs:enumeration value="SUP"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:attribute>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>

	<xs:element name="FT" type="ft"/>

From what I can work out whenever an Element has a Type of "btx" it is supposed to contain text, a description or some information, but I can't work out where to put any text... All the other elements which contain text have a simpleType of xs:string. Can I assume that the "P" element can contain text?

If I can supply any extra code to make this more clear, please let me know.

Thanks very much.

~Ben
Occasional sparks in a darkened room
 
XML:
<xs:complexType name="btx" [COLOR=#CC0000]mixed="true"[/color]>

When the mixed attribute is "true", character data is allowed to appear between the child elements of the complexType element being described.

Tom Morrison
Micro Focus
 
That explains my confusion! Thanks very much

~Ben
Occasional sparks in a darkened room
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top