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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validating Data in XML

Status
Not open for further replies.

bernardmanning

Programmer
Joined
Oct 14, 2003
Messages
61
Location
GB
Hi,

I'm a relative newbie when it comes to XML and have produced some XML files and schemas with some very simple enumerated values for various schemas.

However I've got a situation and I'm not quite sure what's the best way to go about solving it.

Previously, when I wanted to validate data in an element, I used an enumeration value eg
Code:
<xs:element name="Stock_category">
	<xs:simpleType>
		<xs:restriction base="xs:string">
			<xs:enumeration value="On Order"/>
			<xs:enumeration value="Received"/>
			<xs:enumeration value=""/>
		</xs:restriction>
	</xs:simpleType>
</xs:element>
However, I've got a problem in that I need to validate data not on one value but two, eg

I need to represent a table of chemical elements, this would contain the chemical element abbreviation and description. eg

Abbreviation Description
Pb Lead
Cr Chromium
W Tungsten

I need to be able to validate each element to say, for instance, that if the abbreviation is 'Pb' then the description MUST be "Lead"

It wouldn't be acceptable to have an abbreviation of 'Pb' and a description of 'Tungsten'

Could anybody give me any information about how to go about this?

Thanks in advance, Berny


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top