Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


XML-schema problem - conditional attribute

From: "Holger Boskugel" <news.post@----------.-->
To: NULL
Date: 8/23/2009 3:40:00 PM
Hello,

I'm looking for a solution for the following problem:

I have an "Account" element, which in one condition only contains
values from an enumeration and in the other a formated string
"<Domain>\<UserName>" AND the attribute "Password".

The solution I have actually is to use a union of simple types and
set the attribute optional. But I want that in the first case not attribute
should set and in the second the attribute should be required. I woun't
use the alternative way of combining two different elements in an
"choice".

This is my actual schema:

<xs:element name="Account" minOccurs="0" maxOccurs="1"
default="LocalService">
  <xs:complexType>
    <xs:simpleContent>
      <xs:extension base="Account">
        <xs:attribute name="Password" type="xs:string" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
</xs:element>

<xs:simpleType name="Account">
  <xs:union>
    <xs:simpleType>
      <xs:annotation>
        <xs:documentation>Build in accounts</xs:documentation>
      </xs:annotation>

      <xs:restriction base="xs:string">
        <xs:enumeration value="LocalService" />
        <xs:enumeration value="NetworkService" />
        <xs:enumeration value="LocalSystem" />
      </xs:restriction>
    </xs:simpleType>

    <xs:simpleType>
      <xs:annotation>
        <xs:documentation>User accounts</xs:documentation>
      </xs:annotation>

      <xs:restriction base="xs:string">
        <xs:pattern value="^(\.|[\w\-]{1,64})\\\.+$">
          <xs:annotation>
            <xs:documentation><![CDATA[<Domain>\<UserName>]]></xs:documentation>
          </xs:annotation>
        </xs:pattern>
      </xs:restriction>
    </xs:simpleType>
  </xs:union>
</xs:simpleType>

Thank for any hints or a solution.


Kindly reagards from Berlin

Holger
-- 
http://www.vbwebprofi.de 



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent