permaculture playing cards
The moose likes XML and Related Technologies and the fly likes XSD help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XSD help" Watch "XSD help" New topic

XSD help

Md Fizal
Ranch Hand

Joined: Dec 23, 2002
Posts: 61
I'm designing a new XSD and having trouble defining the following condition:

In my XML, I want to define a condition saying, only if tag 'Key' exists then tag 'Value' is a required one, otherwise not. This also means that tag 'Key' is optional too.

How do I define this in XSD?
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
<!-- pseudo code. You need to do some hemework, right?. -->
<define a type>
<define a key tag>
<define a value tag>
<end define of type>

This is the concept you need.

- m

Take a Minute, Donate an Hour, Change a Life
I agree. Here's the link:
subject: XSD help
It's not a secret anymore!