XSD-structur for xml-formular - InfoPath Dev
in

InfoPath Dev

XSD-structur for xml-formular

Last post 04-07-2011 01:21 AM by tschanunnpa. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 04-06-2011 12:30 AM

    XSD-structur for xml-formular

    Hello everybody

    My english is not perfect but I'll try my best.

    Since 2 weeks I'm trying to get a perfect xsd structer for my formular. If I put the following (XSD) element construct in a new InfoPath form, the title element is allowed to be empty. This is actually my problem, because it shouldn't be empty. How can I correct my xsd to get a red star by the titel-element. I'm also  not able to change the configuration in Infopath to set the checkbox "element can't be emtpy".

    Thanks alot and I'm happy about every feedback I'll get. 
    Best regards

    _____________________________________________________
    My element construct:

    <xs:element name="service">
        <xs:complexType>
          <xs:sequence>
            <xs:element minOccurs="1" maxOccurs="unbounded" ref="title"/>
            <xs:element minOccurs="0" maxOccurs="unbounded" ref="description"/>
            <xs:element minOccurs="0" ref="price"/>
            <xs:element minOccurs="0" maxOccurs="unbounded" ref="priceSuffix"/>
            <xs:element minOccurs="0" ref="contacts"/>
            <xs:element minOccurs="0" ref="image"/>
            <xs:element minOccurs="0" ref="contentProperties"/>
          </xs:sequence>
          <xs:attribute name="orderNr" use="required" type="xs:integer"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="title">
        <xs:complexType>
          <xs:simpleContent>
            <xs:extension base="xs:string">
              <xs:attribute name="lang" type="xs:language"/>
            </xs:extension>
          </xs:simpleContent>
        </xs:complexType>
      </xs:element>

    Hakuna Matata
  • 04-06-2011 07:35 AM In reply to

    Re: XSD-structur for xml-formular

    Hello,

    Looks like you can do this by changing the definition of title to be the following:

    <xs:element name="title">
        <xs:complexType>
          <xs:simpleContent>
            <xs:extension base="requiredString">
              <xs:attribute name="lang" type="xs:language"/>
            </xs:extension>
          </xs:simpleContent>
        </xs:complexType>
      </xs:element>
      <xs:simpleType name="requiredString">
        <xs:restriction base="xs:string">
          <xs:minLength value="1"/>
        </xs:restriction>
      </xs:simpleType>

    Is there a particular reason you're writing the schema by hand instead of designing it in InfoPath?  Importing your own schema will likely make it harder to extend the functionality of your form in the future.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 04-07-2011 01:21 AM In reply to

    Re: XSD-structur for xml-formular

    hey my friend

    thanks a lot. it works. The reason is because of the interface which I use for my form. My form is integratet in a big process and needs to be consistent. The interface tells me how to programm my form. Thats way I generated an XSD structer.

    It was my first work with infopath so i just tryed it one way. Im not sure if it would be easier to organise the whole from. But i'll try it with the next big change.

    Thanks a lot again and perhaps until next time.

    Hakuna Matata
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.