I'm not at all sure this is a proper list for asking schema
questions. 

> So I need to make sure that Policy -> Preferences ->
> ServerPreferences -> preference -> name = TARGETS exists as a
> preference in ServerPreferences, however, I need to allow other
> preferences as well but TARGETS must be present.
> any suggestions?

First, unless you really have to, don't use the W3C XML Schema
language.

In RELAX NG, you could use something like:

| start = element serverPreferences {
|      others, TARGETS, others
|      }
| TARGETS = element preference {
|     element name { "TARGETS" },
|     element value { value }
|     }
| others = element preference {
|     element name { prefName },
|     element value { value }
|     }+
| value = ("B" | "C" | "D" )
| prefName = ("A" | "X" | "Y" | "Z")

But this is the sort of thing I would usually do by adding a
Schematron check, rather than using grammar-based validation. E.g.,

| <?xml version="1.0" encoding="UTF-8"?>
| <schema xmlns="http://purl.oclc.org/dsdl/schematron";>
|   <pattern>
|     <rule context="ServerPreferences">
|       <assert test="preference/name[.='TARGETS']">
|         Server preferences should always have a TARGET preference.
|       </assert>
|     </rule>
|   </pattern>
| </schema>

Note: these code fragments are untested.
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to