Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   XML (https://www.delphipraxis.net/46-xml/)
-   -   XML Schema (https://www.delphipraxis.net/65608-xml-schema.html)

Skyrunner2 18. Mär 2006 18:16


XML Schema
 
wie kann ich im volgenden XML schema ausschnitt die elemente "Forced,Primary,Secondary,Restrict" als uniq im "party" element definieren, also das ich nicht in Primary und secondary den selben namen habe... ?

XML-Code:
   <xs:complexType name="Party" id="Party">
      <xs:sequence>
         <xs:element name="Forced" type="xs:IDREF" minOccurs="0" />
         <xs:element name="Primary" type="xs:IDREF" minOccurs="0" />
         <xs:element name="Secondary" type="xs:IDREF" minOccurs="0" />
         <xs:element name="Restrict" type="xs:IDREF" minOccurs="0" maxOccurs="unbounded" />
      </xs:sequence>
      
      <xs:attribute name="name" type="xs:ID" use="required" />
      <xs:attribute name="size" type="xs:positiveInteger" use="required" />
   </xs:complexType>

marabu 18. Mär 2006 20:20

Re: XML Schema
 
Ich fürchte, du musst einen Processor einschalten um dieses constraint zu validieren. XSD kennt zwar das key element, aber so kann meines Wissens kein inter-element constraint formuliert werden.

Grüße vom marabu

Skyrunner2 20. Mär 2006 12:23

Re: XML Schema
 
also laut http://www.xml.com/pub/a/2000/11/29/...t1.html?page=6 kann ich ja mehrere <xs:field xpath="name"/> elemente angeben.

Zitat:

The second path, specified in the xs:field element is evaluated relative to the element identified by the xs:selector, and can be an element or an attribute node. This is the node whose value will be checked for uniqueness. Combinations of values can be specified by adding other xs:field elements within xs:unique.
wobei zu beachten ist (zwischen xs:key und xs:unique)
Zitat:

The second construct, xs:key, is similar to xs:unique except that the value has to be non null (note that xs:unique and xs:key can both be referenced).
das habe ich auch schon ausprobiert, jedoch habe ich scheinbar ein problem mit der Xpath definition, oder es geht einfachnicht (was ich eigentlich nicht denke)

marabu 20. Mär 2006 13:18

Re: XML Schema
 
Vielleicht habe ich mich nicht klar genug ausgedrückt: unter einem inter-element constraint verstehe ich eine dynamische Beschränkung des Wertebereiches von <Secondary> in Abhängigkeit von <Primary> und umgekehrt. Diese Funktionalität erreichst du nicht durch die Definition eines compound key. Ich behaupte nicht, dass es unmöglich ist, nur kenne ich keine deklarative Lösung dafür.

marabu


Alle Zeitangaben in WEZ +1. Es ist jetzt 14:10 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz